For consistency with glibc, our memrchr() implementation returns a
non-const pointer derived from a const pointer passed as an argument.
This can trigger the -Wcast-qual compiler warning, which we have
enabled. So locally supress it for the relevant cast.
Also use the uchar typedef rather than the nonstandard u_char, fixing
the omission from commit 42cedc8f81c9.
---
src/util.c | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/util.c b/src/util.c
index c110188d4fac..22e639f57d68 100644
--- a/src/util.c
+++ b/src/util.c
@@ -454,12 +454,18 @@ vasprintf( char **strp, const char *fmt, va_list ap )
void *
memrchr( const void *s, int c, size_t n )
{
- u_char *b = (u_char *)s, *e = b + n;
+ const uchar *b = s;
+ const uchar *e = b + n;
- while (--e >= b)
- if (*e == c)
+ while (--e >= b) {
+ if (*e == c) {
+DIAG_PUSH
+DIAG_DISABLE("-Wcast-qual")
return (void *)e;
- return 0;
+DIAG_POP
+ }
+ }
+ return NULL;
}
#endif
base-commit: 9aaac66286910f547ec3068d3fd72afb4fe716bf
--
2.50.1 (Apple Git-155)
_______________________________________________
isync-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/isync-devel