snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit 91bb0615d982d1adcc5680c346f9510905464584
parent 00b019b8902e9d319d855b9156f97f931923331c
Author: default <nobody@localhost>
Date:   Sat,  9 Mar 2024 08:44:48 +0100

Replaced most xs_dict_iter() with xs_dict_next().

Diffstat:
Mactivitypub.c | 3++-
Mhtml.c | 6++++--
Mhttpd.c | 3++-
Mmastoapi.c | 3++-
Mutils.c | 3++-
5 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/activitypub.c b/activitypub.c @@ -1221,7 +1221,8 @@ xs_dict *msg_actor(snac *snac) xs_str *k; xs_str *v; - while (xs_dict_iter(&metadata, &k, &v)) { + int c = 0; + while (xs_dict_next(metadata, &k, &v, &c)) { xs *d = xs_dict_new(); xs *k2 = encode_html(k); diff --git a/html.c b/html.c @@ -779,7 +779,8 @@ static xs_html *html_user_body(snac *user, int read_only) xs_html *snac_metadata = xs_html_tag("div", xs_html_attr("class", "snac-metadata")); - while (xs_dict_iter(&metadata, &k, &v)) { + int c = 0; + while (xs_dict_next(metadata, &k, &v, &c)) { xs_html *value; if (xs_startswith(v, "https:/" "/")) { @@ -944,7 +945,8 @@ xs_html *html_top_controls(snac *snac) xs_str *k; xs_str *v; - while (xs_dict_iter(&md, &k, &v)) { + int c = 0; + while (xs_dict_next(md, &k, &v, &c)) { xs *kp = xs_fmt("%s=%s", k, v); if (*metadata) diff --git a/httpd.c b/httpd.c @@ -403,7 +403,8 @@ void httpd_connection(FILE *f) xs_dict *more_headers = xs_dict_get(srv_config, "http_headers"); if (xs_type(more_headers) == XSTYPE_DICT) { char *k, *v; - while (xs_dict_iter(&more_headers, &k, &v)) + int c = 0; + while (xs_dict_next(more_headers, &k, &v, &c)) headers = xs_dict_set(headers, k, v); } diff --git a/mastoapi.c b/mastoapi.c @@ -1172,7 +1172,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path, if (xs_is_null(val_links)) val_links = xs_stock_dict; - while (xs_dict_iter(&metadata, &k, &v)) { + int c = 0; + while (xs_dict_next(metadata, &k, &v, &c)) { xs *val_date = NULL; xs_number *verified_time = xs_dict_get(val_links, v); diff --git a/utils.c b/utils.c @@ -423,7 +423,8 @@ void verify_links(snac *user) headers = xs_dict_append(headers, "accept", "text/html"); headers = xs_dict_append(headers, "user-agent", USER_AGENT " (link verify)"); - while (p && xs_dict_iter(&p, &k, &v)) { + int c = 0; + while (p && xs_dict_next(p, &k, &v, &c)) { /* not an https link? skip */ if (!xs_startswith(v, "https:/" "/")) continue;