![]() |
|
Message-ID: <20250330121748.699050-3-cgoettsche@seltendoof.de> Date: Sun, 30 Mar 2025 14:17:37 +0200 From: Christian Göttsche <cgoettsche@...tendoof.de> To: musl@...ts.openwall.com Cc: Christian Göttsche <cgzones@...glemail.com> Subject: [PATCH 3/4] memmove: avoid dropping const qualifier From: Christian Göttsche <cgzones@...glemail.com> For const correctness retain the const qualifier for pointer casts of the source parameter. --- src/string/memmove.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/string/memmove.c b/src/string/memmove.c index 5dc9cdb9..87806ab1 100644 --- a/src/string/memmove.c +++ b/src/string/memmove.c @@ -21,7 +21,7 @@ void *memmove(void *dest, const void *src, size_t n) if (!n--) return dest; *d++ = *s++; } - for (; n>=WS; n-=WS, d+=WS, s+=WS) *(WT *)d = *(WT *)s; + for (; n>=WS; n-=WS, d+=WS, s+=WS) *(WT *)d = *(const WT *)s; } #endif for (; n; n--) *d++ = *s++; @@ -32,7 +32,7 @@ void *memmove(void *dest, const void *src, size_t n) if (!n--) return dest; d[n] = s[n]; } - while (n>=WS) n-=WS, *(WT *)(d+n) = *(WT *)(s+n); + while (n>=WS) n-=WS, *(WT *)(d+n) = *(const WT *)(s+n); } #endif while (n) n--, d[n] = s[n]; -- 2.49.0
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.