diff options
author | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 16:05:46 +0200 |
---|---|---|
committer | Jannis Hoffmann <jannis@fehcom.de> | 2024-07-09 16:05:46 +0200 |
commit | 08ce54211ce4b8d6092321ca1b28773a680ddc45 (patch) | |
tree | 9cf7eb2702a408743d59e207e24f8fb1e5ada31d /src/byte.c | |
parent | 795ffc5e62e8ba383575dbcd9943a580d4bd3358 (diff) |
Added missing function prototype signatures.
Corrected socket_broadcast name to socket_broadcast4 in socket_if.h.
Added const to fmt_str.
Diffstat (limited to 'src/byte.c')
-rw-r--r-- | src/byte.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -22,8 +22,11 @@ unsigned int byte_chr(char *s, unsigned int n, int c) return t - s; } -void byte_copy(char *to, unsigned int n, char *from) +void byte_copy(void *a, unsigned int n, const void *b) { + char *to = a; + const char *from = b; + for (;;) { // clang-format off if (!n) { return; } *to++ = *from++; --n; @@ -34,10 +37,10 @@ void byte_copy(char *to, unsigned int n, char *from) } } -void byte_copyr(char *to, unsigned int n, char *from) +void byte_copyr(void *a, unsigned int n, const void *b) { - to += n; - from += n; + char *to = a + n; + const char *from = b + n; for (;;) { // clang-format off @@ -49,8 +52,11 @@ void byte_copyr(char *to, unsigned int n, char *from) } } -int byte_diff(char *s, unsigned int n, char *t) +int byte_diff(const void *a, unsigned int n, const void *b) { + const char *s = a; + const char *t = b; + for (;;) { // clang-format off if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n; @@ -80,8 +86,10 @@ unsigned int byte_rchr(char *s, unsigned int n, int c) return u - s; } -void byte_zero(char *s, unsigned int n) +void byte_zero(void *v, unsigned int n) { + char *s = v; + for (;;) { // clang-format off if (!n) { break; } *s++ = 0; --n; @@ -92,8 +100,9 @@ void byte_zero(char *s, unsigned int n) } } -void byte_fill(char *s, unsigned int n, int c) +void byte_fill(void *a, unsigned int n, int c) { + char *s = a; char ch = c; for (;;) { |