From 280344488f09ff29deb052dfa94ed74668c00b18 Mon Sep 17 00:00:00 2001 From: Dirk Engling Date: Fri, 23 Oct 2026 22:10:58 +0200 Subject: Remove last byte_diff and provide more prototypes --- ot_livesync.c | 6 +++--- ot_livesync.h | 6 +++--- ot_sync.c | 9 ++++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/ot_livesync.c b/ot_livesync.c index f620592..efba4d7 100644 --- a/ot_livesync.c +++ b/ot_livesync.c @@ -57,7 +57,7 @@ static sync_buffer g_v6_buf; static sync_buffer g_v4_buf; static pthread_t thread_id; -void livesync_init() { +void livesync_init(void) { if (g_socket_in == -1) exerr("No socket address for live sync specified."); @@ -78,7 +78,7 @@ void livesync_init() { pthread_create(&thread_id, NULL, livesync_worker, NULL); } -void livesync_deinit() { +void livesync_deinit(void) { if (g_socket_in != -1) close(g_socket_in); if (g_socket_out != -1) @@ -167,7 +167,7 @@ static void livesync_handle_peersync(struct ot_workstruct *ws, size_t peer_size) /* Tickle the live sync module from time to time, so no events get stuck when there's not enough traffic to fill udp packets fast enough */ -void livesync_ticker() { +void livesync_ticker(void) { /* livesync_issue_peersync sets g_next_packet_time */ pthread_mutex_lock(&g_outbuf_mutex); if (g_now_seconds > g_v6_buf.next_packet_time && g_v6_buf.fill > sizeof(g_tracker_id) + sizeof(uint32_t)) diff --git a/ot_livesync.h b/ot_livesync.h index cb28774..ed710f0 100644 --- a/ot_livesync.h +++ b/ot_livesync.h @@ -47,8 +47,8 @@ #define LIVESYNC_PORT 9696 -void livesync_init(); -void livesync_deinit(); +void livesync_init(void); +void livesync_deinit(void); /* Join multicast group for listening and create sending socket */ void livesync_bind_mcast(char *ip, uint16_t port); @@ -59,7 +59,7 @@ void livesync_tell(struct ot_workstruct *ws); /* Tickle the live sync module from time to time, so no events get stuck when there's not enough traffic to fill udp packets fast enough */ -void livesync_ticker(); +void livesync_ticker(void); /* Handle an incoming live sync packet */ void handle_livesync(const int64 sock); diff --git a/ot_sync.c b/ot_sync.c index 65a8170..2241bf3 100644 --- a/ot_sync.c +++ b/ot_sync.c @@ -12,7 +12,6 @@ #include /* Libowfat */ -#include "byte.h" #include "io.h" #include "scan.h" @@ -36,15 +35,15 @@ int add_changeset_to_tracker(uint8_t *data, size_t len) { uint8_t *end = data + len; unsigned long peer_count; - /* We do know, that the string is \n terminated, so it cant + /* We do know, that the string is \n terminated, so it can't overflow */ - if (byte_diff(data, 8, "d4:syncd")) + if (!memcmp(data, "d4:syncd", 8)) return -1; data += 8; while (1) { - if (byte_diff(data, 3, "20:")) { - if (byte_diff(data, 2, "ee")) + if (!memcmp(data, "20:", 3)) { + if (!memcmp(data, "ee", 2)) return -1; return 0; } -- cgit v1.3