From e8da064e0d16527a994ec7e3b2937363804b8e30 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Wed, 30 Nov 2022 18:01:43 +0300 Subject: Fixed alignment of ngx_memmove()/ngx_movemem() macro definitions. --- src/core/ngx_string.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/core/ngx_string.h') diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h index 0fb9be72e..4378b649c 100644 --- a/src/core/ngx_string.h +++ b/src/core/ngx_string.h @@ -140,8 +140,8 @@ ngx_copy(u_char *dst, u_char *src, size_t len) #endif -#define ngx_memmove(dst, src, n) (void) memmove(dst, src, n) -#define ngx_movemem(dst, src, n) (((u_char *) memmove(dst, src, n)) + (n)) +#define ngx_memmove(dst, src, n) (void) memmove(dst, src, n) +#define ngx_movemem(dst, src, n) (((u_char *) memmove(dst, src, n)) + (n)) /* msvc and icc7 compile memcmp() to the inline loop */ -- cgit From a77cef0995fb29af6602dcdeb560755443cb2cca Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Wed, 30 Nov 2022 18:01:53 +0300 Subject: Removed casts from ngx_memcmp() macro. Casts are believed to be not needed, since memcmp() has "const void *" arguments since introduction of the "void" type in C89. And on pre-C89 platforms nginx is unlikely to compile without warnings anyway, as there are no casts in memcpy() and memmove() calls. These casts were added in 1648:89a47f19b9ec without any details on why they were added, and Igor does not remember details either. The most plausible explanation is that they were copied from ngx_strcmp() and were not really needed even at that time. Prodded by Alejandro Colomar. --- src/core/ngx_string.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/ngx_string.h') diff --git a/src/core/ngx_string.h b/src/core/ngx_string.h index 4378b649c..713eb42a7 100644 --- a/src/core/ngx_string.h +++ b/src/core/ngx_string.h @@ -145,7 +145,7 @@ ngx_copy(u_char *dst, u_char *src, size_t len) /* msvc and icc7 compile memcmp() to the inline loop */ -#define ngx_memcmp(s1, s2, n) memcmp((const char *) s1, (const char *) s2, n) +#define ngx_memcmp(s1, s2, n) memcmp(s1, s2, n) u_char *ngx_cpystrn(u_char *dst, u_char *src, size_t n); -- cgit