summaryrefslogtreecommitdiff
path: root/mastoapi.c
diff options
context:
space:
mode:
authorGravatar green2025-05-19 15:25:11 +0200
committerGravatar green2025-05-19 15:25:11 +0200
commit321f64ed70d039dea510c8a7d7aee7dc9577737a (patch)
treed7ba8d4398fdc1705cfe436b03bd87860d45d2e7 /mastoapi.c
parentperformance: functions to get the number of followers (diff)
downloadpenes-snac2-321f64ed70d039dea510c8a7d7aee7dc9577737a.tar.gz
penes-snac2-321f64ed70d039dea510c8a7d7aee7dc9577737a.tar.xz
penes-snac2-321f64ed70d039dea510c8a7d7aee7dc9577737a.zip
performance: use following_list_len in more places
Diffstat (limited to 'mastoapi.c')
-rw-r--r--mastoapi.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/mastoapi.c b/mastoapi.c
index 7fa0078..a7d9c34 100644
--- a/mastoapi.c
+++ b/mastoapi.c
@@ -680,10 +680,10 @@ xs_dict *mastoapi_account(snac *logged, const xs_dict *actor)
680 680
681 /* does this user want to publish their contact metrics? */ 681 /* does this user want to publish their contact metrics? */
682 if (xs_is_true(xs_dict_get(user.config, "show_contact_metrics"))) { 682 if (xs_is_true(xs_dict_get(user.config, "show_contact_metrics"))) {
683 xs *fwing = following_list(&user); 683 int fwing = following_list_len(&user);
684 xs *fwers = follower_list(&user); 684 int fwers = follower_list_len(&user);
685 xs *ni = xs_number_new(xs_list_len(fwing)); 685 xs *ni = xs_number_new(fwing);
686 xs *ne = xs_number_new(xs_list_len(fwers)); 686 xs *ne = xs_number_new(fwers);
687 687
688 acct = xs_dict_append(acct, "followers_count", ne); 688 acct = xs_dict_append(acct, "followers_count", ne);
689 acct = xs_dict_append(acct, "following_count", ni); 689 acct = xs_dict_append(acct, "following_count", ni);
@@ -1309,10 +1309,10 @@ void credentials_get(char **body, char **ctype, int *status, snac snac)
1309 1309
1310 /* does this user want to publish their contact metrics? */ 1310 /* does this user want to publish their contact metrics? */
1311 if (xs_is_true(xs_dict_get(snac.config, "show_contact_metrics"))) { 1311 if (xs_is_true(xs_dict_get(snac.config, "show_contact_metrics"))) {
1312 xs *fwing = following_list(&snac); 1312 int fwing = following_list_len(&snac);
1313 xs *fwers = follower_list(&snac); 1313 int fwers = follower_list_len(&snac);
1314 xs *ni = xs_number_new(xs_list_len(fwing)); 1314 xs *ni = xs_number_new(fwing);
1315 xs *ne = xs_number_new(xs_list_len(fwers)); 1315 xs *ne = xs_number_new(fwers);
1316 1316
1317 acct = xs_dict_append(acct, "followers_count", ne); 1317 acct = xs_dict_append(acct, "followers_count", ne);
1318 acct = xs_dict_append(acct, "following_count", ni); 1318 acct = xs_dict_append(acct, "following_count", ni);