-// SPDX-FileCopyrightText: 2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar <alx@kernel.org>
// SPDX-License-Identifier: BSD-3-Clause
#include <string.h>
#include "sizeof.h"
-#include "string/strcpy/strncat.h"
// string n-bounded-read duplicate using-alloca(3)
#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