commit 4fe2ccd

default  ·  2023-11-20 18:47:41 +0000 UTC
parent a6a5190
html_actor_icon() returns an xs_str instead of adding to another one.
1 files changed,  +12, -10
M html.c
M html.c
+12, -10
 1@@ -92,10 +92,10 @@ xs_str *actor_name(xs_dict *actor)
 2 }
 3 
 4 
 5-xs_str *html_actor_icon(xs_str *os, char *actor,
 6-    const char *date, const char *udate, const char *url, int priv)
 7+xs_str *html_actor_icon(xs_dict *actor, const char *date,
 8+                        const char *udate, const char *url, int priv)
 9 {
10-    xs *s = xs_str_new(NULL);
11+    xs_str *s = xs_str_new(NULL);
12 
13     xs *avatar = NULL;
14     char *v;
15@@ -184,7 +184,7 @@ xs_str *html_actor_icon(xs_str *os, char *actor,
16         s = xs_str_cat(s, s1);
17     }
18 
19-    return xs_str_cat(os, s);
20+    return s;
21 }
22 
23 
24@@ -211,7 +211,8 @@ xs_str *html_msg_icon(xs_str *os, const xs_dict *msg)
25         date  = xs_dict_get(msg, "published");
26         udate = xs_dict_get(msg, "updated");
27 
28-        os = html_actor_icon(os, actor, date, udate, url, priv);
29+        xs *s1 = html_actor_icon(actor, date, udate, url, priv);
30+        os = xs_str_cat(os, s1);
31     }
32 
33     return os;
34@@ -1692,9 +1693,10 @@ xs_str *html_people_list(snac *snac, xs_str *os, xs_list *list, const char *head
35         if (valid_status(actor_get(actor_id, &actor))) {
36             s = xs_str_cat(s, "<div class=\"snac-post\">\n<div class=\"snac-post-header\">\n");
37 
38-            s = html_actor_icon(s, actor, xs_dict_get(actor, "published"), NULL, NULL, 0);
39-
40-            s = xs_str_cat(s, "</div>\n");
41+            {
42+                xs *s1 = html_actor_icon(actor, xs_dict_get(actor, "published"), NULL, NULL, 0);
43+                s = xs_str_cat(s, s1, "</div>\n");
44+            }
45 
46             /* content (user bio) */
47             char *c = xs_dict_get(actor, "summary");
48@@ -1898,9 +1900,9 @@ xs_str *html_notifications(snac *snac)
49         if (strcmp(type, "Follow") == 0 || strcmp(utype, "Follow") == 0) {
50             s = xs_str_cat(s, "<div class=\"snac-post\">\n");
51 
52-            s = html_actor_icon(s, actor, NULL, NULL, NULL, 0);
53+            xs *s1 = html_actor_icon(actor, NULL, NULL, NULL, 0);
54 
55-            s = xs_str_cat(s, "</div>\n");
56+            s = xs_str_cat(s, s1, "</div>\n");
57         }
58         else {
59             xs *md5 = xs_md5_hex(id, strlen(id));