]> git.ipfire.org Git - thirdparty/util-linux.git/blobdiff - include/xalloc.h
include/xalloc: ensure xstrdup() and xstrndup() returns nonnull attribute
[thirdparty/util-linux.git] / include / xalloc.h
index 0129a85e2e5bb2a753049b5b4a52780941e52f49..48712a4529142b93c28614a6561380f1ed76c58d 100644 (file)
@@ -62,8 +62,7 @@ static inline char __attribute__((warn_unused_result)) __ul_returns_nonnull
 {
         char *ret;
 
-        if (!str)
-                return NULL;
+        assert(str);
 
         ret = strdup(str);
 
@@ -77,8 +76,7 @@ xstrndup(const char *str, size_t size)
 {
         char *ret;
 
-        if (!str)
-                return NULL;
+        assert(str);
 
         ret = strndup(str, size);