commit 5278232

default  ·  2023-06-18 18:35:16 +0000 UTC
parent b331f36
Delete unnecessary function information in _object_fn().
1 files changed,  +13, -13
M data.c
M data.c
+13, -13
  1@@ -569,10 +569,10 @@ static xs_str *_object_fn_by_md5(const char *md5, const char *func)
  2 }
  3 
  4 
  5-static xs_str *_object_fn(const char *id, const char *func)
  6+static xs_str *_object_fn(const char *id)
  7 {
  8     xs *md5 = xs_md5_hex(id, strlen(id));
  9-    return _object_fn_by_md5(md5, func);
 10+    return _object_fn_by_md5(md5, "_object_fn");
 11 }
 12 
 13 
 14@@ -587,7 +587,7 @@ int object_here_by_md5(const char *id)
 15 int object_here(const char *id)
 16 /* checks if an object is already downloaded */
 17 {
 18-    xs *fn = _object_fn(id, "object_here");
 19+    xs *fn = _object_fn(id);
 20     return mtime(fn) > 0.0;
 21 }
 22 
 23@@ -629,7 +629,7 @@ int _object_add(const char *id, const xs_dict *obj, int ow)
 24 /* stores an object */
 25 {
 26     int status = 201; /* Created */
 27-    xs *fn     = _object_fn(id, "_object_add 1");
 28+    xs *fn     = _object_fn(id);
 29     FILE *f;
 30 
 31     if (!ow && mtime(fn) > 0.0) {
 32@@ -651,7 +651,7 @@ int _object_add(const char *id, const xs_dict *obj, int ow)
 33 
 34         if (!xs_is_null(in_reply_to) && *in_reply_to) {
 35             /* update the children index of the parent */
 36-            xs *c_idx = _object_fn(in_reply_to, "_object_add 2");
 37+            xs *c_idx = _object_fn(in_reply_to);
 38 
 39             c_idx = xs_replace_i(c_idx, ".json", "_c.idx");
 40 
 41@@ -735,7 +735,7 @@ int object_del(const char *id)
 42 int object_del_if_unref(const char *id)
 43 /* deletes an object if its n_links < 2 */
 44 {
 45-    xs *fn = _object_fn(id, "object_del_if_unref");
 46+    xs *fn = _object_fn(id);
 47     int n_links;
 48     int ret = 0;
 49 
 50@@ -763,7 +763,7 @@ double object_ctime(const char *id)
 51 xs_str *_object_index_fn(const char *id, const char *idxsfx)
 52 /* returns the filename of an object's index */
 53 {
 54-    xs_str *fn = _object_fn(id, "_object_index_fn");
 55+    xs_str *fn = _object_fn(id);
 56     return xs_replace_i(fn, ".json", idxsfx);
 57 }
 58 
 59@@ -820,7 +820,7 @@ int object_admire(const char *id, const char *actor, int like)
 60 /* actor likes or announces this object */
 61 {
 62     int status = 200;
 63-    xs *fn     = _object_fn(id, "object_admire");
 64+    xs *fn     = _object_fn(id);
 65 
 66     fn = xs_replace_i(fn, ".json", like ? "_l.idx" : "_a.idx");
 67 
 68@@ -838,7 +838,7 @@ int object_unadmire(const char *id, const char *actor, int like)
 69 /* actor no longer likes or announces this object */
 70 {
 71     int status;
 72-    xs *fn = _object_fn(id, "object_unadmire");
 73+    xs *fn = _object_fn(id);
 74 
 75     fn = xs_replace_i(fn, ".json", like ? "_l.idx" : "_a.idx");
 76 
 77@@ -854,7 +854,7 @@ int object_unadmire(const char *id, const char *actor, int like)
 78 int _object_user_cache(snac *snac, const char *id, const char *cachedir, int del)
 79 /* adds or deletes from a user cache */
 80 {
 81-    xs *ofn = _object_fn(id, "_object_user_cache");
 82+    xs *ofn = _object_fn(id);
 83     xs *l   = xs_split(ofn, "/");
 84     xs *cfn = xs_fmt("%s/%s/%s", snac->basedir, cachedir, xs_list_get(l, -1));
 85     xs *idx = xs_fmt("%s/%s.idx", snac->basedir, cachedir);
 86@@ -1193,7 +1193,7 @@ int following_add(snac *snac, const char *actor, const xs_dict *msg)
 87         fclose(f);
 88 
 89         /* get the filename of the actor object */
 90-        xs *actor_fn = _object_fn(actor, "following_add");
 91+        xs *actor_fn = _object_fn(actor);
 92 
 93         /* increase its reference count */
 94         fn = xs_replace_i(fn, ".json", "_a.json");
 95@@ -1291,7 +1291,7 @@ xs_list *following_list(snac *snac)
 96 
 97                             if (mtime(v2) == 0.0) {
 98                                 /* no; add a link to it */
 99-                                xs *actor_fn = _object_fn(actor, "following_list");
100+                                xs *actor_fn = _object_fn(actor);
101                                 link(actor_fn, v2);
102                             }
103                         }
104@@ -1442,7 +1442,7 @@ int actor_get(snac *snac1, const char *actor, xs_dict **data)
105     else
106         d = xs_free(d);
107 
108-    xs *fn = _object_fn(actor, "actor_get");
109+    xs *fn = _object_fn(actor);
110     double max_time;
111 
112     /* maximum time for the actor data to be considered stale */