]> granicus.if.org Git - zziplib/commitdiff
zzip: string: fix invalid malloc attribute
authorPatrick Steinhardt <ps@pks.im>
Tue, 21 May 2019 11:04:03 +0000 (13:04 +0200)
committerPatrick Steinhardt <ps@pks.im>
Thu, 1 Aug 2019 06:33:34 +0000 (08:33 +0200)
The `_zzip_strnlen` function is annotated with the `zzip_new__` macro,
which is defined to `__attribute__((malloc))` on systems which support
this attribute. The malloc attribute can be applied to functions that
return a pointer value, indicating that a returned non-NULL pointer
cannot alias and that its contents have undefined content. But as
`_zzip_strnlen` neither performs an allocation nor returns a pointer to
memory, we cannot use that attribute here.

Remove it to fix a compiler warning.

zzip/__string.h

index 2103a3bdc0fb0961a30197a579287b049422cb7a..4424348aa6531ba3c8b86d144a1a5ebb1622bb2d 100644 (file)
@@ -19,7 +19,7 @@
 #include <stdlib.h>
 
 /* if your system does not have strnlen: */
-zzip__new__ static size_t
+static size_t
 _zzip_strnlen(const char *p, size_t maxlen)
 {
     const char * stop = (char *)memchr(p, '\0', maxlen);