summaryrefslogtreecommitdiff
path: root/ot_sync.c
diff options
context:
space:
mode:
authorDirk Engling <erdgeist@erdgeist.org>2026-10-26 22:32:52 +0100
committerDirk Engling <erdgeist@erdgeist.org>2026-10-26 22:32:52 +0100
commit1f9494979268b62ed4b4588fb7d9e790c0e12100 (patch)
treeed4f78369fe610b5c9188cb4159a23370d50a799 /ot_sync.c
parent6d5485b97cd46f81512e9198ac7c59c7ba1d9247 (diff)
replace all calls to sprintf with a format helper that advances a cursor. Also convert the meta-formatter (i.e. results printer) to this scheme
Diffstat (limited to 'ot_sync.c')
-rw-r--r--ot_sync.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/ot_sync.c b/ot_sync.c
index f958a20..f656bef 100644
--- a/ot_sync.c
+++ b/ot_sync.c
@@ -11,6 +11,7 @@
11#include <sys/uio.h> 11#include <sys/uio.h>
12 12
13/* Opentracker */ 13/* Opentracker */
14#include "ot_fmt.h"
14#include "ot_iovec.h" 15#include "ot_iovec.h"
15#include "ot_mutex.h" 16#include "ot_mutex.h"
16#include "ot_scan.h" 17#include "ot_scan.h"
@@ -109,14 +110,10 @@ static void sync_make(size_t *iovec_entries, struct iovec **iovector) {
109 re = r + OT_SYNC_CHUNK_SIZE; 110 re = r + OT_SYNC_CHUNK_SIZE;
110 } 111 }
111 112
112 *r++ = '2'; 113 fmt_append(&r, re, "20:");
113 *r++ = '0'; 114 fmt_bytes(&r, re, hash, sizeof(ot_hash));
114 *r++ = ':'; 115 fmt_append(&r, re, "%zd:", byte_count);
115 memmove(r, hash, sizeof(ot_hash)); 116 fmt_bytes(&r, re, peer_list->changeset.data, byte_count);
116 r += sizeof(ot_hash);
117 r += sprintf(r, "%zd:", byte_count);
118 memmove(r, peer_list->changeset.data, byte_count);
119 r += byte_count;
120 } 117 }
121 118
122 /* All torrents done: release lock on currenct bucket */ 119 /* All torrents done: release lock on currenct bucket */