From: Alejandro Colomar Date: Mon, 29 Jan 2024 12:43:07 +0000 (+0100) Subject: lib/string/strftime.[ch]: STRFTIME(): Add macro X-Git-Tag: 4.15.1~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b3affb29cff0b16e24a53e0b629daffb597c499c;p=thirdparty%2Fshadow.git lib/string/strftime.[ch]: STRFTIME(): Add macro This macro makes sure that the first argument is an array, and calculates its size. Reviewed-by: "Serge E. Hallyn" Signed-off-by: Alejandro Colomar --- diff --git a/lib/Makefile.am b/lib/Makefile.am index 58d9c1427..0aa9d5ec5 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -149,6 +149,8 @@ libshadow_la_SOURCES = \ string/stpecpy.h \ string/stpeprintf.c \ string/stpeprintf.h \ + string/strftime.c \ + string/strftime.h \ string/strncpy.h \ string/strtcpy.c \ string/strtcpy.h \ diff --git a/lib/string/strftime.c b/lib/string/strftime.c new file mode 100644 index 000000000..ea1deb3fb --- /dev/null +++ b/lib/string/strftime.c @@ -0,0 +1,7 @@ +// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#include + +#include "strftime.h" diff --git a/lib/string/strftime.h b/lib/string/strftime.h new file mode 100644 index 000000000..bebb31a46 --- /dev/null +++ b/lib/string/strftime.h @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-License-Identifier: BSD-3-Clause + + +#ifndef SHADOW_INCLUDE_LIB_STRFTIME_H_ +#define SHADOW_INCLUDE_LIB_STRFTIME_H_ + + +#include + +#include + +#include "sizeof.h" + + +#define STRFTIME(dst, fmt, ...) strftime(dst, NITEMS(dst), fmt, __VA_ARGS__) + + +#endif // include guard