From: Alejandro Colomar Date: Sun, 19 Jan 2025 14:32:12 +0000 (+0100) Subject: lib/string/strdup/strndupa.h: STRNDUPA(): Simplify implementation X-Git-Tag: 4.18.0-rc1~70 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=0e7162772d045ff20ab3bb655d10b69d1bb017bd;p=thirdparty%2Fshadow.git lib/string/strdup/strndupa.h: STRNDUPA(): Simplify implementation Signed-off-by: Alejandro Colomar --- diff --git a/lib/string/strdup/strndupa.h b/lib/string/strdup/strndupa.h index c8d53f30b..80b8c3dcd 100644 --- a/lib/string/strdup/strndupa.h +++ b/lib/string/strdup/strndupa.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -12,7 +12,6 @@ #include #include "sizeof.h" -#include "string/strcpy/strncat.h" // string n-bounded-read duplicate using-alloca(3) @@ -21,11 +20,7 @@ #endif -// Similar to strndupa(3), but ensure that 's' is an array. -#define STRNDUPA(s) \ -( \ - STRNCAT(strcpy(alloca(strnlen(s, NITEMS(s)) + 1), ""), s) \ -) +#define STRNDUPA(s) strndupa(s, NITEMS(s)) #endif // include guard