From de67a4a721c0fda9a9b5955f235baafba9ba393d Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 23 Oct 2026 21:48:58 +0200 Subject: Rework config file parser and tidy up mem inits --- trackerlogic.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'trackerlogic.c') diff --git a/trackerlogic.c b/trackerlogic.c index 7c6b7e1..94ec71a 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -14,7 +14,6 @@ /* Libowfat */ #include "array.h" -#include "byte.h" #include "io.h" #include "iob.h" #include "ip6.h" @@ -57,7 +56,7 @@ void add_torrent_from_saved_state(ot_hash const hash, ot_time base, size_t down_ return mutex_bucket_unlock_by_hash(hash, 0); /* Create a new torrent entry, then */ - byte_zero(torrent, sizeof(ot_torrent)); + memset(torrent, 0, sizeof(ot_torrent)); memcpy(torrent->hash, hash, sizeof(ot_hash)); if (!(torrent->peer_list6 = malloc(sizeof(ot_peerlist))) || !(torrent->peer_list4 = malloc(sizeof(ot_peerlist)))) { @@ -65,8 +64,8 @@ void add_torrent_from_saved_state(ot_hash const hash, ot_time base, size_t down_ return mutex_bucket_unlock_by_hash(hash, 0); } - byte_zero(torrent->peer_list6, sizeof(ot_peerlist)); - byte_zero(torrent->peer_list4, sizeof(ot_peerlist)); + memset(torrent->peer_list6, 0, sizeof(ot_peerlist)); + memset(torrent->peer_list4, 0, sizeof(ot_peerlist)); torrent->peer_list6->base = base; torrent->peer_list4->base = base; torrent->peer_list6->down_count = down_count; @@ -102,7 +101,7 @@ size_t add_peer_to_torrent_and_return_peers(PROTO_FLAG proto, struct ot_workstru if (!exactmatch) { /* Create a new torrent entry, then */ - byte_zero(torrent, sizeof(ot_torrent)); + memset(torrent, 0, sizeof(ot_torrent)); memcpy(torrent->hash, *ws->hash, sizeof(ot_hash)); if (!(torrent->peer_list6 = malloc(sizeof(ot_peerlist))) || !(torrent->peer_list4 = malloc(sizeof(ot_peerlist)))) { @@ -111,8 +110,8 @@ size_t add_peer_to_torrent_and_return_peers(PROTO_FLAG proto, struct ot_workstru return 0; } - byte_zero(torrent->peer_list6, sizeof(ot_peerlist)); - byte_zero(torrent->peer_list4, sizeof(ot_peerlist)); + memset(torrent->peer_list6, 0, sizeof(ot_peerlist)); + memset(torrent->peer_list4, 0, sizeof(ot_peerlist)); delta_torrentcount = 1; } else clean_single_torrent(torrent); -- cgit v1.3