Browse Source

Replaced most xs_dict_iter() with xs_dict_next().

default 1 year ago
parent
commit
91bb0615d9
5 changed files with 12 additions and 6 deletions
  1. 2 1
      activitypub.c
  2. 4 2
      html.c
  3. 2 1
      httpd.c
  4. 2 1
      mastoapi.c
  5. 2 1
      utils.c

+ 2 - 1
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);

+ 4 - 2
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)

+ 2 - 1
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);
     }
 

+ 2 - 1
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);

+ 2 - 1
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;