]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/string/strdup/xstrndup.h: Add STRNDUP()
authorAlejandro Colomar <alx@kernel.org>
Tue, 27 May 2025 08:48:28 +0000 (10:48 +0200)
committerIker Pedrosa <ikerpedrosam@gmail.com>
Mon, 27 Oct 2025 13:32:06 +0000 (14:32 +0100)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/string/strdup/xstrndup.h

index d3279537aa02435b3636e10b899a935e8dd08da1..082ad3ff947f009d369b2128efb995be5790c37e 100644 (file)
 #include "exit_if_null.h"
 
 
-// Similar to strndup(3), but ensure that 's' is an array, and exit on ENOMEM.
-#define XSTRNDUP(s)  exit_if_null(strndup(s, countof(s)))
+// Similar to strndup(3), but ensure that 's' is an array.
+#define STRNDUP(s)   strndup(s, countof(s))
+
+// exit-on-error nonstring duplicate-into-string
+#define XSTRNDUP(s)  exit_if_null(STRNDUP(s))
 
 
 #endif  // include guard