If we try to compile memset.c with a C++ compiler, we get warnings on
various implied pointer conversions. Let's make them explict, and this
way the code can compile as either C or C++ code.

I want to be able to compile it as C++ code because in the next patch
I want to use it in fastlz/lzloader.cc.

Signed-off-by: Nadav Har'El <n...@scylladb.com>
---
 libc/string/memset.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libc/string/memset.c b/libc/string/memset.c
index 0d7f1c9..c42d00c 100644
--- a/libc/string/memset.c
+++ b/libc/string/memset.c
@@ -9,13 +9,13 @@
 
 void *memset_base(void *dest, int c, size_t n)
 {
-       unsigned char *s = dest;
+       unsigned char *s = (unsigned char *)dest;
        c = (unsigned char)c;
        for (; ((uintptr_t)s & ALIGN) && n; n--) *s++ = c;
        if (n) {
                size_t *w, k = ONES * c;
-               for (w = (void *)s; n>=SS; n-=SS, w++) *w = k;
-               for (s = (void *)w; n; n--, s++) *s = c;
+               for (w = (size_t *)s; n>=SS; n-=SS, w++) *w = k;
+               for (s = (unsigned char *)w; n; n--, s++) *s = c;
        }
        return dest;
 }
-- 
2.9.5

-- 
You received this message because you are subscribed to the Google Groups "OSv 
Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to osv-dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to