]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/string/sprintf/, lib/, src/, tests/: Move all sprintf(3)-like APIs to a subdirectory
authorAlejandro Colomar <alx@kernel.org>
Thu, 27 Jun 2024 09:29:56 +0000 (11:29 +0200)
committerSerge Hallyn <serge@hallyn.com>
Tue, 2 Jul 2024 02:40:11 +0000 (21:40 -0500)
And have a separate file for each pair of APIs.

Signed-off-by: Alejandro Colomar <alx@kernel.org>
38 files changed:
lib/Makefile.am
lib/commonio.c
lib/copydir.c
lib/env.c
lib/get_pid.c
lib/getdef.c
lib/hushed.c
lib/idmapping.c
lib/mail.c
lib/nss.c
lib/prefix_flag.c
lib/pwauth.c
lib/setupenv.c
lib/shell.c
lib/string/sprintf.c [deleted file]
lib/string/sprintf/snprintf.c [new file with mode: 0644]
lib/string/sprintf/snprintf.h [moved from lib/string/sprintf.h with 51% similarity]
lib/string/sprintf/stpeprintf.c [moved from lib/string/stpeprintf.c with 56% similarity]
lib/string/sprintf/stpeprintf.h [moved from lib/string/stpeprintf.h with 88% similarity]
lib/string/sprintf/xasprintf.c [new file with mode: 0644]
lib/string/sprintf/xasprintf.h [new file with mode: 0644]
lib/subordinateio.c
lib/user_busy.c
src/chage.c
src/chfn.c
src/gpasswd.c
src/groupmod.c
src/login.c
src/newgrp.c
src/newusers.c
src/su.c
src/useradd.c
src/userdel.c
src/usermod.c
src/vipw.c
tests/unit/Makefile.am
tests/unit/test_snprintf.c [moved from tests/unit/test_sprintf.c with 97% similarity]
tests/unit/test_xasprintf.c

index 2a65e1d797043444c8b8e0842a0af5e5ec3fe0c0..f6691d4c50359b2024234f6ec0edb04c0c3342de 100644 (file)
@@ -144,12 +144,14 @@ libshadow_la_SOURCES = \
        spawn.c \
        sssd.c \
        sssd.h \
-       string/sprintf.c \
-       string/sprintf.h \
+       string/sprintf/snprintf.c \
+       string/sprintf/snprintf.h \
+       string/sprintf/stpeprintf.c \
+       string/sprintf/stpeprintf.h \
+       string/sprintf/xasprintf.c \
+       string/sprintf/xasprintf.h \
        string/stpecpy.c \
        string/stpecpy.h \
-       string/stpeprintf.c \
-       string/stpeprintf.h \
        string/strftime.c \
        string/strftime.h \
        string/strncpy.h \
index 396feff1af550ab63f717156504434ff3b9fbead..f1723c808073e400c4b5fd0c765d3eed7368929c 100644 (file)
@@ -33,7 +33,7 @@
 #include "prototypes.h"
 #include "commonio.h"
 #include "shadowlog_internal.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 /* local function prototypes */
index 926033afc02681d1dae481dff6b8832f3381d786..58d7cb8cdbbe6d70d50a8bf4f5a1ee144db3aa62 100644 (file)
@@ -36,7 +36,7 @@
 #include <attr/libattr.h>
 #endif                         /* WITH_ATTR */
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 
 static /*@null@*/const char *src_orig;
index 9b5fd32f50a3d47c502167005a6c70c6ce4929c9..8a59468a63cb6ababb8eba790b3740caf4ec7b5a 100644 (file)
--- a/lib/env.c
+++ b/lib/env.c
@@ -20,7 +20,8 @@
 #include "prototypes.h"
 #include "defines.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 
 /*
index f090a265137e651f88e6ca6d5079c4a171f8a9c3..f4d31cfda14012b11aedd1419be56230b63b2502 100644 (file)
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include "atoi/getnum.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 /*
index 30f54bab3159ca618c89ff4c8488b42063a83b11..4b3dc5bb73e3b1e83cee3739223a014bd4772a99 100644 (file)
@@ -26,7 +26,7 @@
 #include "atoi/str2i.h"
 #include "getdef.h"
 #include "shadowlog_internal.h"
-#include "string/sprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 
 /*
index 86c224f3308956ed490b012be916b99bc02432cb..627a0595b3cf7e8cc2e45d3592b871d2e83d693d 100644 (file)
@@ -18,7 +18,7 @@
 #include "defines.h"
 #include "prototypes.h"
 #include "getdef.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 /*
index 56c72eae8f9f98a4d3b69f59bfd8b1e7b75de85a..b74fc2da9337f6746be7b0ae0598001f32f42e17 100644 (file)
@@ -16,7 +16,7 @@
 #include "alloc.h"
 #include "atoi/str2i.h"
 #include "prototypes.h"
-#include "string/stpeprintf.h"
+#include "string/sprintf/stpeprintf.h"
 #include "idmapping.h"
 #if HAVE_SYS_CAPABILITY_H
 #include <sys/prctl.h>
index d14bdb18ac1825a5712c14b986c358eb503258ab..9bbab2699ee3c112dd47ffb44a6ee62e207a6b0d 100644 (file)
@@ -17,7 +17,7 @@
 
 #include "alloc.h"
 #include "getdef.h"
-#include "string/sprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 #ident "$Id$"
 
index dcb8160bdd2cdb89eb196d0d645c2e2dece8ab31..80f5e544f223538a7b402d755f7da29c2600d82f 100644 (file)
--- a/lib/nss.c
+++ b/lib/nss.c
@@ -14,7 +14,7 @@
 #include "../libsubid/subid.h"
 #include "shadowlog_internal.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 #define NSSWITCH "/etc/nsswitch.conf"
index c1245d6aa470707cfaed48201cec1552e879ab8d..3213febdda9992c549f61e3c9f54ae1148c673b2 100644 (file)
@@ -29,7 +29,7 @@
 #endif                         /* ENABLE_SUBIDS */
 #include "getdef.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 
 static char *passwd_db_file = NULL;
index 0cd3412b13793d1ed52ab50906cfd76ca5220b07..bbc2d24197d60f7b02913186c7224e21d2ee48e2 100644 (file)
@@ -25,7 +25,7 @@
 #include "prototypes.h"
 #include "pwauth.h"
 #include "getdef.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 #ifdef SKEY
 #include <skey.h>
index c9b7f26fef29f2e6f769a791e5ca86efb4cdbe3d..8c58ac533dca8ad64edea2f5ab2aee8504f1e531 100644 (file)
@@ -27,7 +27,7 @@
 #include <pwd.h>
 #include "getdef.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 
 #ifndef USE_PAM
index 25ef3e30b3d788268326c86fb4eddc888ceb6dea..b4db966aa09e38ccc9b94805afe0acb33d18658a 100644 (file)
@@ -15,7 +15,7 @@
 #include <errno.h>
 #include "prototypes.h"
 #include "defines.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 extern char **newenvp;
diff --git a/lib/string/sprintf.c b/lib/string/sprintf.c
deleted file mode 100644 (file)
index cf3c210..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
- * SPDX-License-Identifier: BSD-3-Clause
- */
-
-#include <config.h>
-
-#ident "$Id$"
-
-#include "string/sprintf.h"
-
-#include <stdarg.h>
-#include <stddef.h>
-#include <stdio.h>
-
-
-extern inline int xasprintf(char **restrict s, const char *restrict fmt, ...);
-extern inline int xvasprintf(char **restrict s, const char *restrict fmt,
-    va_list ap);
-
-extern inline int snprintf_(char *restrict s, size_t size,
-    const char *restrict fmt, ...);
-extern inline int vsnprintf_(char *restrict s, size_t size,
-    const char *restrict fmt, va_list ap);
diff --git a/lib/string/sprintf/snprintf.c b/lib/string/sprintf/snprintf.c
new file mode 100644 (file)
index 0000000..3a71a69
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "string/sprintf/snprintf.h"
+
+#include <stdarg.h>
+#include <stddef.h>
+
+
+extern inline int snprintf_(char *restrict s, size_t size,
+    const char *restrict fmt, ...);
+extern inline int vsnprintf_(char *restrict s, size_t size,
+    const char *restrict fmt, va_list ap);
similarity index 51%
rename from lib/string/sprintf.h
rename to lib/string/sprintf/snprintf.h
index 748536943234da91afaa172576cf890ed12f2d48..d181c661ac7b4e1e00073c95c2db72b1e626c574 100644 (file)
@@ -1,11 +1,9 @@
-/*
- * SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
- * SPDX-License-Identifier: BSD-3-Clause
- */
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
 
 
-#ifndef SHADOW_INCLUDE_LIB_SPRINTF_H_
-#define SHADOW_INCLUDE_LIB_SPRINTF_H_
+#ifndef SHADOW_INCLUDE_LIB_STRING_SPRINTF_SNPRINTF_H_
+#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_SNPRINTF_H_
 
 
 #include <config.h>
 #include <stdio.h>
 
 #include "attr.h"
-#include "defines.h"
 #include "sizeof.h"
 
 
 #define SNPRINTF(s, fmt, ...)                                                 \
-       snprintf_(s, NITEMS(s), fmt __VA_OPT__(,) __VA_ARGS__)
+(                                                                             \
+       snprintf_(s, NITEMS(s), fmt __VA_OPT__(,) __VA_ARGS__)                \
+)
 
 
-format_attr(printf, 2, 3)
-inline int xasprintf(char **restrict s, const char *restrict fmt, ...);
-format_attr(printf, 2, 0)
-inline int xvasprintf(char **restrict s, const char *restrict fmt, va_list ap);
-
 format_attr(printf, 3, 4)
 inline int snprintf_(char *restrict s, size_t size, const char *restrict fmt,
     ...);
@@ -36,35 +30,6 @@ inline int vsnprintf_(char *restrict s, size_t size, const char *restrict fmt,
     va_list ap);
 
 
-inline int
-xasprintf(char **restrict s, const char *restrict fmt, ...)
-{
-       int      len;
-       va_list  ap;
-
-       va_start(ap, fmt);
-       len = xvasprintf(s, fmt, ap);
-       va_end(ap);
-
-       return len;
-}
-
-
-inline int
-xvasprintf(char **restrict s, const char *restrict fmt, va_list ap)
-{
-       int  len;
-
-       len = vasprintf(s, fmt, ap);
-       if (len == -1) {
-               perror("asprintf");
-               exit(EXIT_FAILURE);
-       }
-
-       return len;
-}
-
-
 inline int
 snprintf_(char *restrict s, size_t size, const char *restrict fmt, ...)
 {
similarity index 56%
rename from lib/string/stpeprintf.c
rename to lib/string/sprintf/stpeprintf.c
index cecd95d7ed1f979cc669bb1b115067c328bd65b9..15148df5ae484d6fa6f18370153eae8177d42663 100644 (file)
@@ -1,25 +1,17 @@
-/*
- * SPDX-FileCopyrightText:  2022 - 2023, Alejandro Colomar <alx@kernel.org>
- *
- * SPDX-License-Identifier:  BSD-3-Clause
- */
+// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
 
 
 #include <config.h>
 
-#if !defined(HAVE_STPEPRINTF)
-
-#ident "$Id$"
-
-#include "string/stpeprintf.h"
+#include "string/sprintf/stpeprintf.h"
 
 #include <stdarg.h>
 
 
+#if !defined(HAVE_STPEPRINTF)
 extern inline char *stpeprintf(char *dst, char *end, const char *restrict fmt,
     ...);
 extern inline char *vstpeprintf(char *dst, char *end, const char *restrict fmt,
     va_list ap);
-
-
-#endif  // !HAVE_STPEPRINTF
+#endif
similarity index 88%
rename from lib/string/stpeprintf.h
rename to lib/string/sprintf/stpeprintf.h
index 14ee7b6ee4924027990e6dd12889bb15944831ea..ccd844bc25b1cbf0e56a36208eafa37d54b3720d 100644 (file)
@@ -1,32 +1,27 @@
-/*
- * SPDX-FileCopyrightText:  2022 - 2023, Alejandro Colomar <alx@kernel.org>
- *
- * SPDX-License-Identifier:  BSD-3-Clause
- */
+// SPDX-FileCopyrightText: 2022-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
 
 
-#ifndef SHADOW_INCLUDE_LIB_STPEPRINTF_H_
-#define SHADOW_INCLUDE_LIB_STPEPRINTF_H_
+#ifndef SHADOW_INCLUDE_LIB_STRING_SPRINTF_STPEPRINTF_H_
+#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_STPEPRINTF_H_
 
 
 #include <config.h>
 
-#if !defined(HAVE_STPEPRINTF)
-
 #include <stdarg.h>
 #include <stddef.h>
 #include <stdio.h>
 
 #include "attr.h"
-#include "defines.h"
 
 
+#if !defined(HAVE_STPEPRINTF)
 format_attr(printf, 3, 4)
 inline char *stpeprintf(char *dst, char *end, const char *restrict fmt, ...);
-
 format_attr(printf, 3, 0)
 inline char *vstpeprintf(char *dst, char *end, const char *restrict fmt,
     va_list ap);
+#endif
 
 
 /*
@@ -79,6 +74,7 @@ inline char *vstpeprintf(char *dst, char *end, const char *restrict fmt,
  */
 
 
+#if !defined(HAVE_STPEPRINTF)
 inline char *
 stpeprintf(char *dst, char *end, const char *restrict fmt, ...)
 {
@@ -91,8 +87,10 @@ stpeprintf(char *dst, char *end, const char *restrict fmt, ...)
 
        return p;
 }
+#endif
 
 
+#if !defined(HAVE_STPEPRINTF)
 inline char *
 vstpeprintf(char *dst, char *end, const char *restrict fmt, va_list ap)
 {
@@ -114,7 +112,7 @@ vstpeprintf(char *dst, char *end, const char *restrict fmt, va_list ap)
 
        return dst + len;
 }
+#endif
 
 
-#endif  // !HAVE_STPEPRINTF
 #endif  // include guard
diff --git a/lib/string/sprintf/xasprintf.c b/lib/string/sprintf/xasprintf.c
new file mode 100644 (file)
index 0000000..2c74056
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "string/sprintf/xasprintf.h"
+
+#include <stdarg.h>
+
+
+extern inline int xasprintf(char **restrict s, const char *restrict fmt, ...);
+extern inline int xvasprintf(char **restrict s, const char *restrict fmt,
+    va_list ap);
diff --git a/lib/string/sprintf/xasprintf.h b/lib/string/sprintf/xasprintf.h
new file mode 100644 (file)
index 0000000..073cb90
--- /dev/null
@@ -0,0 +1,54 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_STRING_SPRINTF_XASPRINTF_H_
+#define SHADOW_INCLUDE_LIB_STRING_SPRINTF_XASPRINTF_H_
+
+
+#include <config.h>
+
+#include <stdarg.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "attr.h"
+
+
+format_attr(printf, 2, 3)
+inline int xasprintf(char **restrict s, const char *restrict fmt, ...);
+format_attr(printf, 2, 0)
+inline int xvasprintf(char **restrict s, const char *restrict fmt, va_list ap);
+
+
+inline int
+xasprintf(char **restrict s, const char *restrict fmt, ...)
+{
+       int      len;
+       va_list  ap;
+
+       va_start(ap, fmt);
+       len = xvasprintf(s, fmt, ap);
+       va_end(ap);
+
+       return len;
+}
+
+
+inline int
+xvasprintf(char **restrict s, const char *restrict fmt, va_list ap)
+{
+       int  len;
+
+       len = vasprintf(s, fmt, ap);
+       if (len == -1) {
+               perror("asprintf");
+               exit(EXIT_FAILURE);
+       }
+
+       return len;
+}
+
+
+#endif  // include guard
index b769aa2a885771cefd7420ab6af0d540372804e8..a4e114de31f11d2086b3a5a17a888b5f793d3c71 100644 (file)
@@ -20,7 +20,7 @@
 
 #include "alloc.h"
 #include "atoi/str2i.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 #define ID_SIZE 31
index 0c7d5cbcad14a71042fd8417c45f87ea04fc8521..495fa535a1d70e2898cfe357793958281c0c3be5 100644 (file)
@@ -25,7 +25,7 @@
 #include "subordinateio.h"
 #endif                         /* ENABLE_SUBIDS */
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 #ifdef __linux__
index 1edab47fa41c8b60cae1a26d31d1ef16c667da4c..57228972a1fcc48971bd3429b66c747adb049e31 100644 (file)
@@ -34,7 +34,7 @@
 #include "pwio.h"
 #include "shadowio.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 #include "string/strftime.h"
 #include "string/strtcpy.h"
 #include "time/day_to_str.h"
index 9043212a1f355ef7c9df3173003360c3f0332d0b..663710648996f04fed864cf00817d982278a1d32 100644 (file)
@@ -32,7 +32,7 @@
 /*@-exitarg@*/
 #include "exitcodes.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 #include "string/strtcpy.h"
 
 
index de6b1c4ccde8b18cdcebc7f8d84c2fe17a9917e5..9983b314a32bd848bf13cd7602b2f094b320746d 100644 (file)
@@ -35,7 +35,7 @@
 /*@-exitarg@*/
 #include "exitcodes.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 #include "string/strtcpy.h"
 
 
index d7aaf66604b0687104d4c0974bc2bd99ba0371c2..5c13d066f05ef513d9a80f919ad47e89cd4dd9f1 100644 (file)
@@ -39,8 +39,8 @@
 #include "sgroupio.h"
 #endif
 #include "shadowlog.h"
+#include "string/sprintf/stpeprintf.h"
 #include "string/stpecpy.h"
-#include "string/stpeprintf.h"
 
 
 /*
index 3a302983f9749a3cc0c355e028f6ec74eb2ea754..0342e8e8a17803950066035ddbafe2a7f4b6c247 100644 (file)
@@ -38,7 +38,7 @@
 /*@-exitarg@*/
 #include "exitcodes.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 #include "string/strftime.h"
 #include "string/strtcpy.h"
 
index 1b3d76b83cac6f0cde1f41defdcec6f3d337f67a..b9aec21d98290bf8943e451690a231ea19d4ac88 100644 (file)
@@ -25,7 +25,7 @@
 /*@-exitarg@*/
 #include "exitcodes.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 /*
index 47a587ec0e545b24eea88ff40210a719e0b11543..ad1723e54e28ad5c111fe30a80fc449549de370f 100644 (file)
@@ -52,7 +52,7 @@
 #endif                         /* ENABLE_SUBIDS */
 #include "chkname.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 /*
index 80c0859711cd7f16f0f80c4dae21b9eb2c39c636..42a72247c9b62c0955e0efdbf3f055749c7bf4af 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -59,7 +59,7 @@
 /*@-exitarg@*/
 #include "exitcodes.h"
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 #include "string/strtcpy.h"
 
 
index 14ab511c9e3de68c5b7fe01c479badb8e2129b69..3f07268496b62463ff861685b8d0f14c77d990b5 100644 (file)
@@ -65,7 +65,8 @@
 #include "tcbfuncs.h"
 #endif
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 
 #ifndef SKEL_DIR
index ff1f7ddf546b3b98e62a54791d2f0ce114eb4752..38158d44332436043b506933b323b319b30e8a3f 100644 (file)
@@ -52,7 +52,7 @@
 #include "subordinateio.h"
 #endif                         /* ENABLE_SUBIDS */
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 
 /*
index 52d9dbb72ef3f9cfc56b7f8b7cbf4a09db5c4d92..2cc35d7542c49688722d8a43765c6b247c44256c 100644 (file)
@@ -61,7 +61,7 @@
 #include "tcbfuncs.h"
 #endif
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/xasprintf.h"
 #include "time/day_to_str.h"
 
 
index c30b32dee3b34e3ab21fa384905e4ebd6b7d1ca1..5d8d1c2e86e167bad186842f443ebee39e4417fa 100644 (file)
@@ -44,7 +44,8 @@
 #include "tcbfuncs.h"
 #endif                         /* WITH_TCB */
 #include "shadowlog.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 
 #define MSG_WARN_EDIT_OTHER_FILE _( \
index 21490f15dbf753f66f891e08d6019257d5e20972..17538776ad925f66aa8fe7abed4b87e188ba9efc 100644 (file)
@@ -7,7 +7,7 @@ check_PROGRAMS = \
     test_adds \
     test_atoi_strtoi \
     test_chkname \
-    test_sprintf \
+    test_snprintf \
     test_strncpy \
     test_strtcpy \
     test_typetraits \
@@ -78,16 +78,16 @@ test_logind_LDADD = \
     $(LIBSYSTEMD) \
     $(NULL)
 
-test_sprintf_SOURCES = \
-    ../../lib/string/sprintf.c \
-    test_sprintf.c \
+test_snprintf_SOURCES = \
+    ../../lib/string/sprintf/snprintf.c \
+    test_snprintf.c \
     $(NULL)
-test_sprintf_CFLAGS = \
+test_snprintf_CFLAGS = \
     $(AM_CFLAGS) \
     $(NULL)
-test_sprintf_LDFLAGS = \
+test_snprintf_LDFLAGS = \
     $(NULL)
-test_sprintf_LDADD = \
+test_snprintf_LDADD = \
     $(CMOCKA_LIBS) \
     $(NULL)
 
@@ -129,7 +129,7 @@ test_typetraits_LDADD = \
     $(NULL)
 
 test_xasprintf_SOURCES = \
-    ../../lib/string/sprintf.c \
+    ../../lib/string/sprintf/xasprintf.c \
     test_xasprintf.c \
     $(NULL)
 test_xasprintf_CFLAGS = \
similarity index 97%
rename from tests/unit/test_sprintf.c
rename to tests/unit/test_snprintf.c
index bedcff6f4cfa54097a588fae449f9f46298237bd..bdef8ac9ab51042f5c2c7dc81c57bce3b840fe41 100644 (file)
@@ -14,7 +14,7 @@
 #include <cmocka.h>
 
 #include "sizeof.h"
-#include "string/sprintf.h"
+#include "string/sprintf/snprintf.h"
 
 
 static void test_SNPRINTF_trunc(void **state);
index 4c27d78a8a5c2e6991027373435a14330db7f9d2..3f3566898010893bfdccb46096a605032060f788 100644 (file)
@@ -16,7 +16,7 @@
 #include <stdint.h>  // Required by <cmocka.h>
 #include <cmocka.h>
 
-#include "string/sprintf.h"
+#include "string/sprintf/xasprintf.h"
 
 
 #define assert_unreachable()  assert_true(0)