From ebf02266a2cd663ad4744d3b8c07e211b8f38da1 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Wed, 2 Nov 2022 21:45:40 +0100 Subject: Removed the unsafe nxt_memchr() wrapper for memchr(3). The casts are unnecessary, since memchr(3)'s argument is 'const void *'. It might have been necessary in the times of K&R, where 'void *' didn't exist. Nowadays, it's unnecessary, and _very_ unsafe, since casts can hide all classes of bugs by silencing most compiler warnings. The changes from nxt_memchr() to memchr(3) were scripted: $ find src/ -type f \ | grep '\.[ch]$' \ | xargs sed -i 's/nxt_memchr/memchr/' Reviewed-by: Andrew Clayton Signed-off-by: Alejandro Colomar --- src/nxt_string.h | 4 ---- 1 file changed, 4 deletions(-) (limited to 'src/nxt_string.h') diff --git a/src/nxt_string.h b/src/nxt_string.h index d021df69..18ea5490 100644 --- a/src/nxt_string.h +++ b/src/nxt_string.h @@ -66,10 +66,6 @@ nxt_cpymem(void *dst, const void *src, size_t length) (void) memmove(dst, src, length) -#define nxt_memchr(s, c, length) \ - memchr((char *) s, c, length) - - #define nxt_strcmp(s1, s2) \ strcmp((char *) s1, (char *) s2) -- cgit