Replaced most xs_dict_iter() with xs_dict_next().

This commit is contained in:
default 2024-03-09 08:44:48 +01:00
parent 00b019b890
commit 91bb0615d9
5 changed files with 12 additions and 6 deletions

View file

@ -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);

6
html.c
View file

@ -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)

View file

@ -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);
}

View file

@ -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);

View file

@ -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;