From 4ece9d359fd6668bfbc9c4260463f5b5913ae8fc Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 23 Oct 2026 22:16:25 +0200 Subject: Avoid returning the result of void functions --- trackerlogic.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'trackerlogic.c') diff --git a/trackerlogic.c b/trackerlogic.c index 94ec71a..a76064e 100644 --- a/trackerlogic.c +++ b/trackerlogic.c @@ -48,12 +48,16 @@ void add_torrent_from_saved_state(ot_hash const hash, ot_time base, size_t down_ ot_torrent *torrent; ot_vector *torrents_list = mutex_bucket_lock_by_hash(hash); - if (!accesslist_hashisvalid(hash)) - return mutex_bucket_unlock_by_hash(hash, 0); + if (!accesslist_hashisvalid(hash)) { + mutex_bucket_unlock_by_hash(hash, 0); + return; + } torrent = vector_find_or_insert(torrents_list, (void *)hash, sizeof(ot_torrent), OT_HASH_COMPARE_SIZE, &exactmatch); - if (!torrent || exactmatch) - return mutex_bucket_unlock_by_hash(hash, 0); + if (!torrent || exactmatch) { + mutex_bucket_unlock_by_hash(hash, 0); + return; + } /* Create a new torrent entry, then */ memset(torrent, 0, sizeof(ot_torrent)); @@ -61,7 +65,8 @@ void add_torrent_from_saved_state(ot_hash const hash, ot_time base, size_t down_ if (!(torrent->peer_list6 = malloc(sizeof(ot_peerlist))) || !(torrent->peer_list4 = malloc(sizeof(ot_peerlist)))) { vector_remove_torrent(torrents_list, torrent); - return mutex_bucket_unlock_by_hash(hash, 0); + mutex_bucket_unlock_by_hash(hash, 0); + return; } memset(torrent->peer_list6, 0, sizeof(ot_peerlist)); @@ -71,7 +76,7 @@ void add_torrent_from_saved_state(ot_hash const hash, ot_time base, size_t down_ torrent->peer_list6->down_count = down_count; torrent->peer_list4->down_count = down_count; - return mutex_bucket_unlock_by_hash(hash, 1); + mutex_bucket_unlock_by_hash(hash, 1); } size_t add_peer_to_torrent_and_return_peers(PROTO_FLAG proto, struct ot_workstruct *ws, size_t amount) { -- cgit v1.3