summaryrefslogtreecommitdiff
path: root/data.c
diff options
context:
space:
mode:
authorGravatar default2023-06-18 20:35:16 +0200
committerGravatar default2023-06-18 20:35:16 +0200
commit52782326160f6d8ecbae26de665502d3fecd7753 (patch)
treeed20e03c43495b0be6e0f442b19fb9350dbec6f0 /data.c
parentImproved checks to _object_fn_by_md5(). (diff)
downloadsnac2-52782326160f6d8ecbae26de665502d3fecd7753.tar.gz
snac2-52782326160f6d8ecbae26de665502d3fecd7753.tar.xz
snac2-52782326160f6d8ecbae26de665502d3fecd7753.zip
Delete unnecessary function information in _object_fn().
Diffstat (limited to 'data.c')
-rw-r--r--data.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/data.c b/data.c
index 56649de..e0a263b 100644
--- a/data.c
+++ b/data.c
@@ -569,10 +569,10 @@ static xs_str *_object_fn_by_md5(const char *md5, const char *func)
569} 569}
570 570
571 571
572static xs_str *_object_fn(const char *id, const char *func) 572static xs_str *_object_fn(const char *id)
573{ 573{
574 xs *md5 = xs_md5_hex(id, strlen(id)); 574 xs *md5 = xs_md5_hex(id, strlen(id));
575 return _object_fn_by_md5(md5, func); 575 return _object_fn_by_md5(md5, "_object_fn");
576} 576}
577 577
578 578
@@ -587,7 +587,7 @@ int object_here_by_md5(const char *id)
587int object_here(const char *id) 587int object_here(const char *id)
588/* checks if an object is already downloaded */ 588/* checks if an object is already downloaded */
589{ 589{
590 xs *fn = _object_fn(id, "object_here"); 590 xs *fn = _object_fn(id);
591 return mtime(fn) > 0.0; 591 return mtime(fn) > 0.0;
592} 592}
593 593
@@ -629,7 +629,7 @@ int _object_add(const char *id, const xs_dict *obj, int ow)
629/* stores an object */ 629/* stores an object */
630{ 630{
631 int status = 201; /* Created */ 631 int status = 201; /* Created */
632 xs *fn = _object_fn(id, "_object_add 1"); 632 xs *fn = _object_fn(id);
633 FILE *f; 633 FILE *f;
634 634
635 if (!ow && mtime(fn) > 0.0) { 635 if (!ow && mtime(fn) > 0.0) {
@@ -651,7 +651,7 @@ int _object_add(const char *id, const xs_dict *obj, int ow)
651 651
652 if (!xs_is_null(in_reply_to) && *in_reply_to) { 652 if (!xs_is_null(in_reply_to) && *in_reply_to) {
653 /* update the children index of the parent */ 653 /* update the children index of the parent */
654 xs *c_idx = _object_fn(in_reply_to, "_object_add 2"); 654 xs *c_idx = _object_fn(in_reply_to);
655 655
656 c_idx = xs_replace_i(c_idx, ".json", "_c.idx"); 656 c_idx = xs_replace_i(c_idx, ".json", "_c.idx");
657 657
@@ -735,7 +735,7 @@ int object_del(const char *id)
735int object_del_if_unref(const char *id) 735int object_del_if_unref(const char *id)
736/* deletes an object if its n_links < 2 */ 736/* deletes an object if its n_links < 2 */
737{ 737{
738 xs *fn = _object_fn(id, "object_del_if_unref"); 738 xs *fn = _object_fn(id);
739 int n_links; 739 int n_links;
740 int ret = 0; 740 int ret = 0;
741 741
@@ -763,7 +763,7 @@ double object_ctime(const char *id)
763xs_str *_object_index_fn(const char *id, const char *idxsfx) 763xs_str *_object_index_fn(const char *id, const char *idxsfx)
764/* returns the filename of an object's index */ 764/* returns the filename of an object's index */
765{ 765{
766 xs_str *fn = _object_fn(id, "_object_index_fn"); 766 xs_str *fn = _object_fn(id);
767 return xs_replace_i(fn, ".json", idxsfx); 767 return xs_replace_i(fn, ".json", idxsfx);
768} 768}
769 769
@@ -820,7 +820,7 @@ int object_admire(const char *id, const char *actor, int like)
820/* actor likes or announces this object */ 820/* actor likes or announces this object */
821{ 821{
822 int status = 200; 822 int status = 200;
823 xs *fn = _object_fn(id, "object_admire"); 823 xs *fn = _object_fn(id);
824 824
825 fn = xs_replace_i(fn, ".json", like ? "_l.idx" : "_a.idx"); 825 fn = xs_replace_i(fn, ".json", like ? "_l.idx" : "_a.idx");
826 826
@@ -838,7 +838,7 @@ int object_unadmire(const char *id, const char *actor, int like)
838/* actor no longer likes or announces this object */ 838/* actor no longer likes or announces this object */
839{ 839{
840 int status; 840 int status;
841 xs *fn = _object_fn(id, "object_unadmire"); 841 xs *fn = _object_fn(id);
842 842
843 fn = xs_replace_i(fn, ".json", like ? "_l.idx" : "_a.idx"); 843 fn = xs_replace_i(fn, ".json", like ? "_l.idx" : "_a.idx");
844 844
@@ -854,7 +854,7 @@ int object_unadmire(const char *id, const char *actor, int like)
854int _object_user_cache(snac *snac, const char *id, const char *cachedir, int del) 854int _object_user_cache(snac *snac, const char *id, const char *cachedir, int del)
855/* adds or deletes from a user cache */ 855/* adds or deletes from a user cache */
856{ 856{
857 xs *ofn = _object_fn(id, "_object_user_cache"); 857 xs *ofn = _object_fn(id);
858 xs *l = xs_split(ofn, "/"); 858 xs *l = xs_split(ofn, "/");
859 xs *cfn = xs_fmt("%s/%s/%s", snac->basedir, cachedir, xs_list_get(l, -1)); 859 xs *cfn = xs_fmt("%s/%s/%s", snac->basedir, cachedir, xs_list_get(l, -1));
860 xs *idx = xs_fmt("%s/%s.idx", snac->basedir, cachedir); 860 xs *idx = xs_fmt("%s/%s.idx", snac->basedir, cachedir);
@@ -1193,7 +1193,7 @@ int following_add(snac *snac, const char *actor, const xs_dict *msg)
1193 fclose(f); 1193 fclose(f);
1194 1194
1195 /* get the filename of the actor object */ 1195 /* get the filename of the actor object */
1196 xs *actor_fn = _object_fn(actor, "following_add"); 1196 xs *actor_fn = _object_fn(actor);
1197 1197
1198 /* increase its reference count */ 1198 /* increase its reference count */
1199 fn = xs_replace_i(fn, ".json", "_a.json"); 1199 fn = xs_replace_i(fn, ".json", "_a.json");
@@ -1291,7 +1291,7 @@ xs_list *following_list(snac *snac)
1291 1291
1292 if (mtime(v2) == 0.0) { 1292 if (mtime(v2) == 0.0) {
1293 /* no; add a link to it */ 1293 /* no; add a link to it */
1294 xs *actor_fn = _object_fn(actor, "following_list"); 1294 xs *actor_fn = _object_fn(actor);
1295 link(actor_fn, v2); 1295 link(actor_fn, v2);
1296 } 1296 }
1297 } 1297 }
@@ -1442,7 +1442,7 @@ int actor_get(snac *snac1, const char *actor, xs_dict **data)
1442 else 1442 else
1443 d = xs_free(d); 1443 d = xs_free(d);
1444 1444
1445 xs *fn = _object_fn(actor, "actor_get"); 1445 xs *fn = _object_fn(actor);
1446 double max_time; 1446 double max_time;
1447 1447
1448 /* maximum time for the actor data to be considered stale */ 1448 /* maximum time for the actor data to be considered stale */