diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-26 22:32:52 +0100 |
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2026-10-26 22:32:52 +0100 |
| commit | 1f9494979268b62ed4b4588fb7d9e790c0e12100 (patch) | |
| tree | ed4f78369fe610b5c9188cb4159a23370d50a799 /ot_sync.c | |
| parent | 6d5485b97cd46f81512e9198ac7c59c7ba1d9247 (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.c | 13 |
1 files changed, 5 insertions, 8 deletions
| @@ -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 */ |
