From: Karel Zak Date: Mon, 28 Feb 2022 09:27:05 +0000 (+0100) Subject: include/strutils: mark some arguments as non-null X-Git-Tag: v2.38-rc2~15 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d57672e2a6737d891f00b1bb2bc12d715daa04b1;p=thirdparty%2Futil-linux.git include/strutils: mark some arguments as non-null Signed-off-by: Karel Zak --- diff --git a/include/strutils.h b/include/strutils.h index 8968524a61..ae689a30ad 100644 --- a/include/strutils.h +++ b/include/strutils.h @@ -90,7 +90,8 @@ static inline void xstrncpy(char *dest, const char *src, size_t n) * Use this function to copy string to logs with fixed sizes (wtmp/utmp. ...) * where string terminator is optional. */ -static inline void *str2memcpy(void *dest, const char *src, size_t n) +static inline void * __attribute__((nonnull (1))) +str2memcpy(void *dest, const char *src, size_t n) { size_t bytes = strlen(src) + 1; @@ -101,7 +102,8 @@ static inline void *str2memcpy(void *dest, const char *src, size_t n) return dest; } -static inline char *mem2strcpy(char *dest, const void *src, size_t n, size_t nmax) +static inline char * __attribute__((nonnull (1))) +mem2strcpy(char *dest, const void *src, size_t n, size_t nmax) { if (n + 1 > nmax) n = nmax - 1;