From 91bb0615d982d1adcc5680c346f9510905464584 Mon Sep 17 00:00:00 2001 From: default Date: Sat, 9 Mar 2024 08:44:48 +0100 Subject: [PATCH] Replaced most xs_dict_iter() with xs_dict_next(). --- activitypub.c | 3 ++- html.c | 6 ++++-- httpd.c | 3 ++- mastoapi.c | 3 ++- utils.c | 3 ++- 5 files changed, 12 insertions(+), 6 deletions(-) diff --git a/activitypub.c b/activitypub.c index f754ee0..1976012 100644 --- 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 index d34439a..59fd6c9 100644 --- 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 index 319a7b3..d74642f 100644 --- 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 index 685c644..416f96c 100644 --- 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 index d8cebdc..35caa6e 100644 --- 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;