]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
include/strutils: mark some arguments as non-null
authorKarel Zak <kzak@redhat.com>
Mon, 28 Feb 2022 09:27:05 +0000 (10:27 +0100)
committerKarel Zak <kzak@redhat.com>
Mon, 28 Feb 2022 09:27:05 +0000 (10:27 +0100)
Signed-off-by: Karel Zak <kzak@redhat.com>
include/strutils.h

index 8968524a61d378855844400a6c62d39b68f2e248..ae689a30ad22939456dad9af3c86836adf8e09a5 100644 (file)
@@ -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;