From 6837c5ac80e3624c6dc3a82d03e50d68b2f5a989 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Mon, 26 Oct 2026 17:13:36 +0100 Subject: Second run of making variable and function names more readable, urlencoder now matches overall naming scheme --- ot_stats.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'ot_stats.c') diff --git a/ot_stats.c b/ot_stats.c index 6589aef..ceeb89d 100644 --- a/ot_stats.c +++ b/ot_stats.c @@ -345,15 +345,15 @@ size_t stats_top_txt(char *reply, size_t amount) { r += sprintf(r, "Top %zd torrents by peers:\n", amount); for (idx = 0; idx < amount; ++idx) if (top100c[idx].val) - r += sprintf(r, "\t%zd\t%s\n", top100c[idx].val, hex_fromhash(hex_out, top100c[idx].hash)); + r += sprintf(r, "\t%zd\t%s\n", top100c[idx].val, hex_from_hash(hex_out, top100c[idx].hash)); r += sprintf(r, "Top %zd torrents by seeds:\n", amount); for (idx = 0; idx < amount; ++idx) if (top100s[idx].val) - r += sprintf(r, "\t%zd\t%s\n", top100s[idx].val, hex_fromhash(hex_out, top100s[idx].hash)); + r += sprintf(r, "\t%zd\t%s\n", top100s[idx].val, hex_from_hash(hex_out, top100s[idx].hash)); r += sprintf(r, "Top %zd torrents by leechers:\n", amount); for (idx = 0; idx < amount; ++idx) if (top100l[idx].val) - r += sprintf(r, "\t%zd\t%s\n", top100l[idx].val, hex_fromhash(hex_out, top100l[idx].hash)); + r += sprintf(r, "\t%zd\t%s\n", top100l[idx].val, hex_from_hash(hex_out, top100l[idx].hash)); return r - reply; } @@ -459,7 +459,7 @@ static void stats_return_fulllog(size_t *iovec_entries, struct iovec **iovector, while (loglist) { if (r + (loglist->size + 64) >= re) { - r = iovec_fix_increase_or_free(iovec_entries, iovector, r, 32 * OT_STATS_TMPSIZE); + r = iovec_next_chunk(iovec_entries, iovector, r, 32 * OT_STATS_TMPSIZE); if (!r) return; re = r + 32 * OT_STATS_TMPSIZE; @@ -479,7 +479,7 @@ static void stats_return_fulllog(size_t *iovec_entries, struct iovec **iovector, free(loglist); loglist = llnext; } - iovec_fixlast(iovec_entries, iovector, r); + iovec_trim_last(iovec_entries, iovector, r); } #endif @@ -570,7 +570,7 @@ static void stats_make(size_t *iovec_entries, struct iovec **iovector, ot_taskty *iovec_entries = 0; *iovector = NULL; - if (!(r = iovec_increase(iovec_entries, iovector, OT_STATS_TMPSIZE))) + if (!(r = iovec_new_chunk(iovec_entries, iovector, OT_STATS_TMPSIZE))) return; switch (mode & TASK_TASK_MASK) { @@ -587,13 +587,13 @@ static void stats_make(size_t *iovec_entries, struct iovec **iovector, ot_taskty r += stats_top_txt(r, 10); break; case TASK_STATS_TOP100: - r = iovec_fix_increase_or_free(iovec_entries, iovector, r, 4 * OT_STATS_TMPSIZE); + r = iovec_next_chunk(iovec_entries, iovector, r, 4 * OT_STATS_TMPSIZE); if (!r) return; r += stats_top_txt(r, 100); break; case TASK_STATS_EVERYTHING: - r = iovec_fix_increase_or_free(iovec_entries, iovector, r, OT_STATS_TMPSIZE + 64 * OT_PEER_TIMEOUT); + r = iovec_next_chunk(iovec_entries, iovector, r, OT_STATS_TMPSIZE + 64 * OT_PEER_TIMEOUT); if (!r) return; r += stats_return_everything(r); @@ -612,7 +612,7 @@ static void stats_make(size_t *iovec_entries, struct iovec **iovector, ot_taskty iovec_free(iovec_entries, iovector); return; } - iovec_fixlast(iovec_entries, iovector, r); + iovec_trim_last(iovec_entries, iovector, r); } void stats_issue_event(ot_status_event event, PROTO_FLAG proto, uintptr_t event_data) { @@ -651,9 +651,9 @@ void stats_issue_event(ot_status_event event, PROTO_FLAG proto, uintptr_t event_ localtime_r(&ttt, &time_now); strftime(timestring, sizeof(timestring), "%FT%T%z", &time_now); - hex_fromhash(hash_hex, *ws->hash); + hex_from_hash(hash_hex, *ws->hash); if (ws->peer_id) - hex_fromhash(peerid_hex, (uint8_t *)ws->peer_id); + hex_from_hash(peerid_hex, (uint8_t *)ws->peer_id); else { *peerid_hex = 0; } -- cgit v1.3