From: Patrick Steinhardt Date: Tue, 21 May 2019 11:04:03 +0000 (+0200) Subject: zzip: string: fix invalid malloc attribute X-Git-Tag: v0.13.70~2^2~11^2~8 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=102052089a94da95d7c8039f5cf030869aeba439;p=zziplib zzip: string: fix invalid malloc attribute 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. --- diff --git a/zzip/__string.h b/zzip/__string.h index 2103a3b..4424348 100644 --- a/zzip/__string.h +++ b/zzip/__string.h @@ -19,7 +19,7 @@ #include /* 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);