Paul Eggert <[EMAIL PROTECTED]> writes: > Simon Josefsson <[EMAIL PROTECTED]> writes: > >> I am not sure about the prototype. Should it use 'char*'? 'int*'? > > If its name is mem* then it should use void *, for consistency. > > The current implementation uses 'restrict', so memxor.m4 should > AC_REQUIRE([gl_C_RESTRICT]) and the memxor module should depend on the > restrict module.
The module depend on restrict, but the AC_REQUIRE in m4 wasn't present. I added it. But is it necessary? Shouldn't depending on the restrict module be sufficient? > The current implementation casts 'const void *' to 'char *', which > will provoke warnings with many compilers. Also, it contains > unnecessary casts. How about this implementation instead? > > char *d = dest; > char const *s = src; > > for (; n > 0; n--) > *d++ ^= *s++; > > return dest; Thanks, I installed the following: --- memxor.c 05 Oct 2005 16:57:55 +0200 1.2 +++ memxor.c 06 Oct 2005 13:18:31 +0200 @@ -27,10 +27,11 @@ void * memxor (void *restrict dest, const void *restrict src, size_t n) { + char const *s = src; char *d = dest; for (; n > 0; n--) - *(char*)d++ ^= *(char*)src++; + *d++ ^= *s++; return dest; } _______________________________________________ bug-gnulib mailing list bug-gnulib@gnu.org http://lists.gnu.org/mailman/listinfo/bug-gnulib