commit 91bb061

default  ·  2024-03-09 07:44:48 +0000 UTC
parent 00b019b
Replaced most xs_dict_iter() with xs_dict_next().
5 files changed,  +12, -6
M html.c
+2, -1
 1@@ -1221,7 +1221,8 @@ xs_dict *msg_actor(snac *snac)
 2         xs_str *k;
 3         xs_str *v;
 4 
 5-        while (xs_dict_iter(&metadata, &k, &v)) {
 6+        int c = 0;
 7+        while (xs_dict_next(metadata, &k, &v, &c)) {
 8             xs *d = xs_dict_new();
 9 
10             xs *k2 = encode_html(k);
M html.c
+4, -2
 1@@ -779,7 +779,8 @@ static xs_html *html_user_body(snac *user, int read_only)
 2             xs_html *snac_metadata = xs_html_tag("div",
 3                 xs_html_attr("class", "snac-metadata"));
 4 
 5-            while (xs_dict_iter(&metadata, &k, &v)) {
 6+            int c = 0;
 7+            while (xs_dict_next(metadata, &k, &v, &c)) {
 8                 xs_html *value;
 9 
10                 if (xs_startswith(v, "https:/" "/")) {
11@@ -944,7 +945,8 @@ xs_html *html_top_controls(snac *snac)
12     xs_str *k;
13     xs_str *v;
14 
15-    while (xs_dict_iter(&md, &k, &v)) {
16+    int c = 0;
17+    while (xs_dict_next(md, &k, &v, &c)) {
18         xs *kp = xs_fmt("%s=%s", k, v);
19 
20         if (*metadata)
+2, -1
 1@@ -403,7 +403,8 @@ void httpd_connection(FILE *f)
 2     xs_dict *more_headers = xs_dict_get(srv_config, "http_headers");
 3     if (xs_type(more_headers) == XSTYPE_DICT) {
 4         char *k, *v;
 5-        while (xs_dict_iter(&more_headers, &k, &v))
 6+        int c = 0;
 7+        while (xs_dict_next(more_headers, &k, &v, &c))
 8             headers = xs_dict_set(headers, k, v);
 9     }
10 
+2, -1
 1@@ -1172,7 +1172,8 @@ int mastoapi_get_handler(const xs_dict *req, const char *q_path,
 2                 if (xs_is_null(val_links))
 3                     val_links = xs_stock_dict;
 4 
 5-                while (xs_dict_iter(&metadata, &k, &v)) {
 6+                int c = 0;
 7+                while (xs_dict_next(metadata, &k, &v, &c)) {
 8                     xs *val_date = NULL;
 9 
10                     xs_number *verified_time = xs_dict_get(val_links, v);
+2, -1
 1@@ -423,7 +423,8 @@ void verify_links(snac *user)
 2     headers = xs_dict_append(headers, "accept", "text/html");
 3     headers = xs_dict_append(headers, "user-agent", USER_AGENT " (link verify)");
 4 
 5-    while (p && xs_dict_iter(&p, &k, &v)) {
 6+    int c = 0;
 7+    while (p && xs_dict_next(p, &k, &v, &c)) {
 8         /* not an https link? skip */
 9         if (!xs_startswith(v, "https:/" "/"))
10             continue;