From 655ffcbe1b77b35a62a92640e5ea5393b23a0f31 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Thu, 2 Jan 2025 00:12:51 +0100 Subject: [PATCH] lib/, src/, tests/: Move x*() definitions to non-x* header files Now that all of these are one-liners, they don't need a separate header file. Compact stuff. Signed-off-by: Alejandro Colomar --- lib/Makefile.am | 18 ++++-------------- lib/alloc/calloc.h | 7 ++++++- lib/alloc/malloc.h | 6 +++++- lib/alloc/realloc.h | 7 ++++++- lib/alloc/x/xcalloc.h | 18 ------------------ lib/alloc/x/xmalloc.c | 7 ------- lib/alloc/x/xmalloc.h | 18 ------------------ lib/alloc/x/xrealloc.c | 7 ------- lib/alloc/x/xrealloc.h | 18 ------------------ lib/copydir.c | 3 +-- lib/env.c | 9 +++++---- lib/getdef.c | 2 +- lib/idmapping.c | 2 +- lib/list.c | 4 ++-- lib/mail.c | 2 +- lib/obscure.c | 4 ++-- lib/prefix_flag.c | 2 +- lib/setupenv.c | 4 ++-- lib/shadow/gshadow/sgetsgent.c | 2 +- lib/string/sprintf/aprintf.h | 5 +++++ lib/string/sprintf/xaprintf.c | 7 ------- lib/string/sprintf/xaprintf.h | 19 ------------------- .../x/xcalloc.c => string/strdup/strdup.c} | 2 +- lib/string/strdup/{xstrdup.h => strdup.h} | 4 ++-- lib/string/strdup/{xstrndup.c => strndup.c} | 2 +- lib/string/strdup/{xstrndup.h => strndup.h} | 4 ++-- lib/string/strdup/xstrdup.c | 7 ------- lib/string/strtok/astrsep2ls.h | 10 +++++++--- lib/string/strtok/xastrsep2ls.c | 7 ------- lib/string/strtok/xastrsep2ls.h | 18 ------------------ lib/utmp.c | 8 ++++---- lib/xgetXXbyYY.c | 2 +- src/chage.c | 2 +- src/chfn.c | 2 +- src/chsh.c | 2 +- src/gpasswd.c | 4 ++-- src/groupmems.c | 4 ++-- src/groupmod.c | 4 ++-- src/login.c | 4 ++-- src/newgrp.c | 5 +++-- src/newusers.c | 2 +- src/passwd.c | 4 ++-- src/su.c | 6 +++--- src/sulogin.c | 2 +- src/useradd.c | 5 ++--- src/userdel.c | 3 +-- src/usermod.c | 5 ++--- src/vipw.c | 1 - tests/unit/Makefile.am | 1 - tests/unit/test_xaprintf.c | 2 +- 50 files changed, 88 insertions(+), 205 deletions(-) delete mode 100644 lib/alloc/x/xcalloc.h delete mode 100644 lib/alloc/x/xmalloc.c delete mode 100644 lib/alloc/x/xmalloc.h delete mode 100644 lib/alloc/x/xrealloc.c delete mode 100644 lib/alloc/x/xrealloc.h delete mode 100644 lib/string/sprintf/xaprintf.c delete mode 100644 lib/string/sprintf/xaprintf.h rename lib/{alloc/x/xcalloc.c => string/strdup/strdup.c} (80%) rename lib/string/strdup/{xstrdup.h => strdup.h} (83%) rename lib/string/strdup/{xstrndup.c => strndup.c} (78%) rename lib/string/strdup/{xstrndup.h => strndup.h} (80%) delete mode 100644 lib/string/strdup/xstrdup.c delete mode 100644 lib/string/strtok/xastrsep2ls.c delete mode 100644 lib/string/strtok/xastrsep2ls.h diff --git a/lib/Makefile.am b/lib/Makefile.am index 45d9b1ec2..b6420e3dc 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -37,12 +37,6 @@ libshadow_la_SOURCES = \ alloc/realloc.h \ alloc/reallocf.c \ alloc/reallocf.h \ - alloc/x/xcalloc.c \ - alloc/x/xcalloc.h \ - alloc/x/xmalloc.c \ - alloc/x/xmalloc.h \ - alloc/x/xrealloc.c \ - alloc/x/xrealloc.h \ atoi/a2i/a2i.c \ atoi/a2i/a2i.h \ atoi/a2i/a2s.c \ @@ -223,8 +217,6 @@ libshadow_la_SOURCES = \ string/sprintf/snprintf.h \ string/sprintf/stpeprintf.c \ string/sprintf/stpeprintf.h \ - string/sprintf/xaprintf.c \ - string/sprintf/xaprintf.h \ string/strchr/strchrcnt.c \ string/strchr/strchrcnt.h \ string/strchr/strchrscnt.c \ @@ -249,12 +241,12 @@ libshadow_la_SOURCES = \ string/strcpy/strncpy.h \ string/strcpy/strtcpy.c \ string/strcpy/strtcpy.h \ + string/strdup/strdup.c \ + string/strdup/strdup.h \ string/strdup/strndupa.c \ string/strdup/strndupa.h \ - string/strdup/xstrdup.c \ - string/strdup/xstrdup.h \ - string/strdup/xstrndup.c \ - string/strdup/xstrndup.h \ + string/strdup/strndup.c \ + string/strdup/strndup.h \ string/strftime.c \ string/strftime.h \ string/strspn/stpspn.c \ @@ -275,8 +267,6 @@ libshadow_la_SOURCES = \ string/strtok/strsep2arr.h \ string/strtok/strsep2ls.c \ string/strtok/strsep2ls.h \ - string/strtok/xastrsep2ls.c \ - string/strtok/xastrsep2ls.h \ strtoday.c \ sub.c \ subordinateio.h \ diff --git a/lib/alloc/calloc.h b/lib/alloc/calloc.h index 01517204d..c6db93dc2 100644 --- a/lib/alloc/calloc.h +++ b/lib/alloc/calloc.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -10,6 +10,8 @@ #include +#include "exit_if_null.h" + #define CALLOC(n, type) \ ( \ @@ -17,4 +19,7 @@ ) +#define XCALLOC(n, type) exit_if_null(CALLOC(n, type)) + + #endif // include guard diff --git a/lib/alloc/malloc.h b/lib/alloc/malloc.h index 16f0b8cd6..1c0c2366a 100644 --- a/lib/alloc/malloc.h +++ b/lib/alloc/malloc.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -11,6 +11,7 @@ #include #include "attr.h" +#include "exit_if_null.h" #define MALLOC(n, type) \ @@ -19,6 +20,9 @@ ) +#define XMALLOC(n, type) exit_if_null(MALLOC(n, type)) + + ATTR_ALLOC_SIZE(1, 2) ATTR_MALLOC(free) inline void *mallocarray(size_t nmemb, size_t size); diff --git a/lib/alloc/realloc.h b/lib/alloc/realloc.h index 3e3d547e3..10b68e0fe 100644 --- a/lib/alloc/realloc.h +++ b/lib/alloc/realloc.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -10,6 +10,8 @@ #include +#include "exit_if_null.h" + #define REALLOC(p, n, type) \ ( \ @@ -17,4 +19,7 @@ ) +#define XREALLOC(p, n, type) exit_if_null(REALLOC(p, n, type)) + + #endif // include guard diff --git a/lib/alloc/x/xcalloc.h b/lib/alloc/x/xcalloc.h deleted file mode 100644 index 849d0728b..000000000 --- a/lib/alloc/x/xcalloc.h +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#ifndef SHADOW_INCLUDE_LIB_ALLOC_X_XCALLOC_H_ -#define SHADOW_INCLUDE_LIB_ALLOC_X_XCALLOC_H_ - - -#include "config.h" - -#include "alloc/calloc.h" -#include "exit_if_null.h" - - -#define XCALLOC(n, type) exit_if_null(CALLOC(n, type)) - - -#endif // include guard diff --git a/lib/alloc/x/xmalloc.c b/lib/alloc/x/xmalloc.c deleted file mode 100644 index ab03820b7..000000000 --- a/lib/alloc/x/xmalloc.c +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#include "config.h" - -#include "alloc/x/xmalloc.h" diff --git a/lib/alloc/x/xmalloc.h b/lib/alloc/x/xmalloc.h deleted file mode 100644 index 5a1c13bc4..000000000 --- a/lib/alloc/x/xmalloc.h +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#ifndef SHADOW_INCLUDE_LIB_ALLOC_X_XMALLOC_H_ -#define SHADOW_INCLUDE_LIB_ALLOC_X_XMALLOC_H_ - - -#include "config.h" - -#include "alloc/malloc.h" -#include "exit_if_null.h" - - -#define XMALLOC(n, type) exit_if_null(MALLOC(n, type)) - - -#endif // include guard diff --git a/lib/alloc/x/xrealloc.c b/lib/alloc/x/xrealloc.c deleted file mode 100644 index d04ed2486..000000000 --- a/lib/alloc/x/xrealloc.c +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#include "config.h" - -#include "alloc/x/xrealloc.h" diff --git a/lib/alloc/x/xrealloc.h b/lib/alloc/x/xrealloc.h deleted file mode 100644 index c395a7308..000000000 --- a/lib/alloc/x/xrealloc.h +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#ifndef SHADOW_INCLUDE_LIB_ALLOC_X_XREALLOC_H_ -#define SHADOW_INCLUDE_LIB_ALLOC_X_XREALLOC_H_ - - -#include "config.h" - -#include "alloc/realloc.h" -#include "exit_if_null.h" - - -#define XREALLOC(p, n, type) exit_if_null(REALLOC(p, n, type)) - - -#endif // include guard diff --git a/lib/copydir.c b/lib/copydir.c index 736e23046..018d3be75 100644 --- a/lib/copydir.c +++ b/lib/copydir.c @@ -19,7 +19,7 @@ #include #include -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" #include "attr.h" #include "fs/readlink/areadlink.h" #include "prototypes.h" @@ -39,7 +39,6 @@ #endif /* WITH_ATTR */ #include "shadowlog.h" #include "string/sprintf/aprintf.h" -#include "string/sprintf/xaprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" diff --git a/lib/env.c b/lib/env.c index 3cc5b61ee..91424087d 100644 --- a/lib/env.c +++ b/lib/env.c @@ -16,15 +16,16 @@ #include #include -#include "alloc/x/xmalloc.h" -#include "alloc/x/xrealloc.h" +#include "alloc/malloc.h" +#include "alloc/realloc.h" #include "prototypes.h" #include "defines.h" #include "shadowlog.h" +#include "string/sprintf/aprintf.h" #include "string/sprintf/snprintf.h" -#include "string/sprintf/xaprintf.h" +#include "string/sprintf/aprintf.h" #include "string/strcmp/strprefix.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" /* diff --git a/lib/getdef.c b/lib/getdef.c index 5aad2b6ad..940b1c7b0 100644 --- a/lib/getdef.c +++ b/lib/getdef.c @@ -30,7 +30,7 @@ #include "prototypes.h" #include "shadowlog_internal.h" #include "sizeof.h" -#include "string/sprintf/xaprintf.h" +#include "string/sprintf/aprintf.h" #include "string/strcmp/strcaseeq.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" diff --git a/lib/idmapping.c b/lib/idmapping.c index e55de97fb..6f32c45e9 100644 --- a/lib/idmapping.c +++ b/lib/idmapping.c @@ -20,7 +20,7 @@ #endif #include "alloc/calloc.h" -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" #include "atoi/a2i/a2u.h" #include "idmapping.h" #include "prototypes.h" diff --git a/lib/list.c b/lib/list.c index be8c2ef77..097d22a68 100644 --- a/lib/list.c +++ b/lib/list.c @@ -12,12 +12,12 @@ #include -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" #include "prototypes.h" #include "defines.h" #include "string/strchr/strchrcnt.h" #include "string/strcmp/streq.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #include "string/strtok/strsep2ls.h" diff --git a/lib/mail.c b/lib/mail.c index 519f385e6..aa670a83e 100644 --- a/lib/mail.c +++ b/lib/mail.c @@ -16,7 +16,7 @@ #include #include "getdef.h" -#include "string/sprintf/xaprintf.h" +#include "string/sprintf/aprintf.h" #ident "$Id$" diff --git a/lib/obscure.c b/lib/obscure.c index 0b5d574d6..adefa72ef 100644 --- a/lib/obscure.c +++ b/lib/obscure.c @@ -21,9 +21,9 @@ #include "getdef.h" #include "string/ctype/strtoascii/strtolower.h" #include "string/memset/memzero.h" -#include "string/sprintf/xaprintf.h" +#include "string/sprintf/aprintf.h" #include "string/strcmp/streq.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #if WITH_LIBBSD == 0 diff --git a/lib/prefix_flag.c b/lib/prefix_flag.c index dd5972cc7..d452d4c31 100644 --- a/lib/prefix_flag.c +++ b/lib/prefix_flag.c @@ -31,7 +31,7 @@ #include "getdef.h" #include "shadow/gshadow/gshadow.h" #include "shadowlog.h" -#include "string/sprintf/xaprintf.h" +#include "string/sprintf/aprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" diff --git a/lib/setupenv.c b/lib/setupenv.c index f5bf2cfad..1b9a417b1 100644 --- a/lib/setupenv.c +++ b/lib/setupenv.c @@ -26,10 +26,10 @@ #include #include "getdef.h" #include "shadowlog.h" -#include "string/sprintf/xaprintf.h" +#include "string/sprintf/aprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #include "string/strspn/stpspn.h" #include "string/strtok/stpsep.h" diff --git a/lib/shadow/gshadow/sgetsgent.c b/lib/shadow/gshadow/sgetsgent.c index c15bb5831..38dce1c0c 100644 --- a/lib/shadow/gshadow/sgetsgent.c +++ b/lib/shadow/gshadow/sgetsgent.c @@ -16,9 +16,9 @@ #include "shadow/gshadow/sgrp.h" #include "string/strcmp/streq.h" +#include "string/strtok/astrsep2ls.h" #include "string/strtok/stpsep.h" #include "string/strtok/strsep2arr.h" -#include "string/strtok/xastrsep2ls.h" #if defined(SHADOWGRP) && !__has_include() diff --git a/lib/string/sprintf/aprintf.h b/lib/string/sprintf/aprintf.h index a90742652..eaf64e941 100644 --- a/lib/string/sprintf/aprintf.h +++ b/lib/string/sprintf/aprintf.h @@ -14,6 +14,11 @@ #include #include "attr.h" +#include "exit_if_null.h" + + +// exit-on-error allocate print formatted +#define xaprintf(...) exit_if_null(aprintf(__VA_ARGS__)) ATTR_MALLOC(free) diff --git a/lib/string/sprintf/xaprintf.c b/lib/string/sprintf/xaprintf.c deleted file mode 100644 index 87617e768..000000000 --- a/lib/string/sprintf/xaprintf.c +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#include "config.h" - -#include "string/sprintf/xaprintf.h" diff --git a/lib/string/sprintf/xaprintf.h b/lib/string/sprintf/xaprintf.h deleted file mode 100644 index 6b23385c2..000000000 --- a/lib/string/sprintf/xaprintf.h +++ /dev/null @@ -1,19 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2025, Alejandro Colomar -// 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 "string/sprintf/aprintf.h" -#include "exit_if_null.h" - - -// exit-on-error allocate print formatted -#define xaprintf(...) exit_if_null(aprintf(__VA_ARGS__)) - - -#endif // include guard diff --git a/lib/alloc/x/xcalloc.c b/lib/string/strdup/strdup.c similarity index 80% rename from lib/alloc/x/xcalloc.c rename to lib/string/strdup/strdup.c index 107f05490..f7169ae0b 100644 --- a/lib/alloc/x/xcalloc.c +++ b/lib/string/strdup/strdup.c @@ -4,4 +4,4 @@ #include "config.h" -#include "alloc/x/xcalloc.h" +#include "string/strdup/strdup.h" diff --git a/lib/string/strdup/xstrdup.h b/lib/string/strdup/strdup.h similarity index 83% rename from lib/string/strdup/xstrdup.h rename to lib/string/strdup/strdup.h index 9ba3f8359..8d13fc9ed 100644 --- a/lib/string/strdup/xstrdup.h +++ b/lib/string/strdup/strdup.h @@ -6,8 +6,8 @@ // SPDX-License-Identifier: BSD-3-Clause -#ifndef SHADOW_INCLUDE_LIB_STRING_STRDUP_XSTRDUP_H_ -#define SHADOW_INCLUDE_LIB_STRING_STRDUP_XSTRDUP_H_ +#ifndef SHADOW_INCLUDE_LIB_STRING_STRDUP_STRDUP_H_ +#define SHADOW_INCLUDE_LIB_STRING_STRDUP_STRDUP_H_ #include "config.h" diff --git a/lib/string/strdup/xstrndup.c b/lib/string/strdup/strndup.c similarity index 78% rename from lib/string/strdup/xstrndup.c rename to lib/string/strdup/strndup.c index 075c1c82f..961f665ba 100644 --- a/lib/string/strdup/xstrndup.c +++ b/lib/string/strdup/strndup.c @@ -4,4 +4,4 @@ #include "config.h" -#include "string/strdup/xstrndup.h" +#include "string/strdup/strndup.h" diff --git a/lib/string/strdup/xstrndup.h b/lib/string/strdup/strndup.h similarity index 80% rename from lib/string/strdup/xstrndup.h rename to lib/string/strdup/strndup.h index 082ad3ff9..5971220a1 100644 --- a/lib/string/strdup/xstrndup.h +++ b/lib/string/strdup/strndup.h @@ -2,8 +2,8 @@ // SPDX-License-Identifier: BSD-3-Clause -#ifndef SHADOW_INCLUDE_LIB_STRING_STRDUP_XSTRNDUP_H_ -#define SHADOW_INCLUDE_LIB_STRING_STRDUP_XSTRNDUP_H_ +#ifndef SHADOW_INCLUDE_LIB_STRING_STRDUP_STRNDUP_H_ +#define SHADOW_INCLUDE_LIB_STRING_STRDUP_STRNDUP_H_ #include "config.h" diff --git a/lib/string/strdup/xstrdup.c b/lib/string/strdup/xstrdup.c deleted file mode 100644 index 3b83e1814..000000000 --- a/lib/string/strdup/xstrdup.c +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#include "config.h" - -#include "string/strdup/xstrdup.h" diff --git a/lib/string/strtok/astrsep2ls.h b/lib/string/strtok/astrsep2ls.h index ccacecab0..1a58e1c59 100644 --- a/lib/string/strtok/astrsep2ls.h +++ b/lib/string/strtok/astrsep2ls.h @@ -1,4 +1,4 @@ -// SPDX-FileCopyrightText: 2024, Alejandro Colomar +// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar // SPDX-License-Identifier: BSD-3-Clause @@ -12,18 +12,22 @@ #include "alloc/malloc.h" #include "attr.h" +#include "exit_if_null.h" #include "string/strchr/strchrscnt.h" #include "string/strtok/strsep2ls.h" +// xastrsep2ls - exit-on-error allocate string separate to list-of-strings +#define xastrsep2ls(s, delim, np) exit_if_null(astrsep2ls(s, delim, np)) + + ATTR_ACCESS(read_write, 1) ATTR_ACCESS(write_only, 3) ATTR_STRING(1) ATTR_STRING(2) inline char **astrsep2ls(char *restrict s, const char *restrict delim, size_t *restrict np); -// allocate string separate to list-of-strings -// Like strsep2ls(), but allocate the list array. +// astrsep2ls - allocate string separate to list-of-strings inline char ** astrsep2ls(char *s, const char *restrict delim, size_t *restrict np) { diff --git a/lib/string/strtok/xastrsep2ls.c b/lib/string/strtok/xastrsep2ls.c deleted file mode 100644 index c3d43b90c..000000000 --- a/lib/string/strtok/xastrsep2ls.c +++ /dev/null @@ -1,7 +0,0 @@ -// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#include "config.h" - -#include "string/strtok/xastrsep2ls.h" diff --git a/lib/string/strtok/xastrsep2ls.h b/lib/string/strtok/xastrsep2ls.h deleted file mode 100644 index d9710db87..000000000 --- a/lib/string/strtok/xastrsep2ls.h +++ /dev/null @@ -1,18 +0,0 @@ -// SPDX-FileCopyrightText: 2024-2025, Alejandro Colomar -// SPDX-License-Identifier: BSD-3-Clause - - -#ifndef SHADOW_INCLUDE_LIB_STRING_STRTOK_XASTRSEP2LS_H_ -#define SHADOW_INCLUDE_LIB_STRING_STRTOK_XASTRSEP2LS_H_ - - -#include "config.h" - -#include "exit_if_null.h" -#include "string/strtok/astrsep2ls.h" - - -#define xastrsep2ls(s, delim, np) exit_if_null(astrsep2ls(s, delim, np)) - - -#endif // include guard diff --git a/lib/utmp.c b/lib/utmp.c index 9c7466352..675d3c8eb 100644 --- a/lib/utmp.c +++ b/lib/utmp.c @@ -26,8 +26,8 @@ #include #include -#include "alloc/x/xcalloc.h" -#include "alloc/x/xmalloc.h" +#include "alloc/calloc.h" +#include "alloc/malloc.h" #include "attr.h" #include "sizeof.h" #include "string/strchr/strnul.h" @@ -36,8 +36,8 @@ #include "string/strcmp/strprefix.h" #include "string/strcpy/strncpy.h" #include "string/strcpy/strtcpy.h" -#include "string/strdup/xstrdup.h" -#include "string/strdup/xstrndup.h" +#include "string/strdup/strdup.h" +#include "string/strdup/strndup.h" #ident "$Id$" diff --git a/lib/xgetXXbyYY.c b/lib/xgetXXbyYY.c index 01976fe72..1a4ca94bb 100644 --- a/lib/xgetXXbyYY.c +++ b/lib/xgetXXbyYY.c @@ -32,7 +32,7 @@ #include #include "alloc/malloc.h" -#include "alloc/x/xrealloc.h" +#include "alloc/realloc.h" #include "prototypes.h" #include "shadowlog.h" diff --git a/src/chage.c b/src/chage.c index bf5d5ef8c..693bad86c 100644 --- a/src/chage.c +++ b/src/chage.c @@ -32,7 +32,7 @@ #include "string/sprintf/snprintf.h" #include "string/strcmp/streq.h" #include "string/strcpy/strtcpy.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #include "string/strftime.h" #include "time/day_to_str.h" /*@-exitarg@*/ diff --git a/src/chfn.c b/src/chfn.c index 53190bdb6..582b51e07 100644 --- a/src/chfn.c +++ b/src/chfn.c @@ -38,7 +38,7 @@ #include "string/sprintf/stpeprintf.h" #include "string/strcmp/streq.h" #include "string/strcpy/strtcpy.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" struct option_flags { bool chroot; diff --git a/src/chsh.c b/src/chsh.c index 0f03deed5..e87a466d7 100644 --- a/src/chsh.c +++ b/src/chsh.c @@ -34,7 +34,7 @@ #include "sssd.h" #include "string/strcmp/streq.h" #include "string/strcpy/strtcpy.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #ifndef SHELLS_FILE diff --git a/src/gpasswd.c b/src/gpasswd.c index 5b32fb7d6..4baa9a3aa 100644 --- a/src/gpasswd.c +++ b/src/gpasswd.c @@ -21,7 +21,7 @@ #include #include "agetpass.h" -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" #include "attr.h" #include "defines.h" /*@-exitarg@*/ @@ -39,7 +39,7 @@ #include "string/sprintf/snprintf.h" #include "string/strcmp/streq.h" #include "string/strcpy/strtcpy.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" struct option_flags { bool chroot; diff --git a/src/groupmems.c b/src/groupmems.c index 3890e023c..d8c2643ce 100644 --- a/src/groupmems.c +++ b/src/groupmems.c @@ -19,7 +19,7 @@ #endif /* USE_PAM */ #include -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" #include "defines.h" #include "groupio.h" #include "prototypes.h" @@ -29,7 +29,7 @@ #include "shadow/gshadow/sgrp.h" #include "shadowlog.h" #include "string/strcmp/streq.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" /* Exit Status Values */ diff --git a/src/groupmod.c b/src/groupmod.c index 7cdc88d9d..0fb21ccf5 100644 --- a/src/groupmod.c +++ b/src/groupmod.c @@ -27,7 +27,7 @@ #endif /* USE_PAM */ #endif /* ACCT_TOOLS_SETUID */ -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" #include "atoi/getnum.h" #include "chkname.h" #include "defines.h" @@ -44,7 +44,7 @@ #include "string/sprintf/stpeprintf.h" #include "string/strcmp/streq.h" #include "string/strcpy/stpecpy.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" /* diff --git a/src/login.c b/src/login.c index f52dbeec7..8b5315346 100644 --- a/src/login.c +++ b/src/login.c @@ -26,7 +26,7 @@ #include #include -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" #include "attr.h" #include "chkname.h" #include "defines.h" @@ -45,7 +45,7 @@ #include "string/strcmp/strneq.h" #include "string/strcmp/strprefix.h" #include "string/strcpy/strtcpy.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #include "string/strftime.h" diff --git a/src/newgrp.c b/src/newgrp.c index 51b1dcc06..123f1b285 100644 --- a/src/newgrp.c +++ b/src/newgrp.c @@ -17,7 +17,8 @@ #include #include "agetpass.h" -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" +#include "alloc/realloc.h" #include "chkname.h" #include "defines.h" /*@-exitarg@*/ @@ -34,7 +35,7 @@ #include "string/sprintf/snprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #include diff --git a/src/newusers.c b/src/newusers.c index d60c92f74..a7ab4a981 100644 --- a/src/newusers.c +++ b/src/newusers.c @@ -57,7 +57,7 @@ #include "sssd.h" #include "string/sprintf/snprintf.h" #include "string/strcmp/streq.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #include "string/strtok/stpsep.h" #include "string/strtok/strsep2arr.h" diff --git a/src/passwd.c b/src/passwd.c index d00a4022e..a29f9640b 100644 --- a/src/passwd.c +++ b/src/passwd.c @@ -33,11 +33,11 @@ #include "shadowlog.h" #include "sssd.h" #include "string/memset/memzero.h" -#include "string/sprintf/xaprintf.h" +#include "string/sprintf/aprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" #include "string/strcpy/strtcpy.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #include "time/day_to_str.h" diff --git a/src/su.c b/src/su.c index ed4086b64..98ced92a0 100644 --- a/src/su.c +++ b/src/su.c @@ -46,7 +46,7 @@ #include #endif /* !USE_PAM */ -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" #include "attr.h" #include "cast.h" #include "defines.h" @@ -59,12 +59,12 @@ #include "pwauth.h" #include "prototypes.h" #include "shadowlog.h" +#include "string/sprintf/aprintf.h" #include "string/sprintf/snprintf.h" -#include "string/sprintf/xaprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" #include "string/strcpy/strtcpy.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" /* diff --git a/src/sulogin.c b/src/sulogin.c index b5a8c0678..74d2ff376 100644 --- a/src/sulogin.c +++ b/src/sulogin.c @@ -29,7 +29,7 @@ #include "shadowlog.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" /* diff --git a/src/useradd.c b/src/useradd.c index 28338cf51..a4dd3638a 100644 --- a/src/useradd.c +++ b/src/useradd.c @@ -37,7 +37,7 @@ #include #include -#include "alloc/x/xmalloc.h" +#include "alloc/malloc.h" #include "atoi/a2i/a2s.h" #include "atoi/getnum.h" #include "chkname.h" @@ -70,11 +70,10 @@ #include "string/memset/memzero.h" #include "string/sprintf/aprintf.h" #include "string/sprintf/snprintf.h" -#include "string/sprintf/xaprintf.h" #include "string/strcmp/strcaseeq.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #include "string/strtok/stpsep.h" diff --git a/src/userdel.c b/src/userdel.c index 3754d1ffd..ae8cb61a3 100644 --- a/src/userdel.c +++ b/src/userdel.c @@ -53,10 +53,9 @@ #include "shadow/gshadow/sgrp.h" #include "shadowlog.h" #include "string/sprintf/aprintf.h" -#include "string/sprintf/xaprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" /* diff --git a/src/usermod.c b/src/usermod.c index d0d68ca9a..414ff7b56 100644 --- a/src/usermod.c +++ b/src/usermod.c @@ -34,7 +34,6 @@ #include #include "alloc/malloc.h" -#include "alloc/x/xmalloc.h" #include "atoi/a2i/a2i.h" #include "atoi/a2i/a2s.h" #include "atoi/getnum.h" @@ -65,10 +64,10 @@ #include "shadowlog.h" #include "sssd.h" #include "string/memset/memzero.h" -#include "string/sprintf/xaprintf.h" +#include "string/sprintf/aprintf.h" #include "string/strcmp/streq.h" #include "string/strcmp/strprefix.h" -#include "string/strdup/xstrdup.h" +#include "string/strdup/strdup.h" #include "time/day_to_str.h" #include "typetraits.h" diff --git a/src/vipw.c b/src/vipw.c index a888fddfd..29fa55a87 100644 --- a/src/vipw.c +++ b/src/vipw.c @@ -45,7 +45,6 @@ #include "sssd.h" #include "string/sprintf/aprintf.h" #include "string/sprintf/snprintf.h" -#include "string/sprintf/xaprintf.h" #include "string/strcmp/streq.h" diff --git a/tests/unit/Makefile.am b/tests/unit/Makefile.am index 8de0a0e0b..e10c0ca38 100644 --- a/tests/unit/Makefile.am +++ b/tests/unit/Makefile.am @@ -133,7 +133,6 @@ test_xaprintf_SOURCES = \ ../../lib/exit_if_null.c \ ../../lib/shadowlog.c \ ../../lib/string/sprintf/aprintf.c \ - ../../lib/string/sprintf/xaprintf.c \ ../../lib/string/strcmp/streq.c \ test_xaprintf.c \ $(NULL) diff --git a/tests/unit/test_xaprintf.c b/tests/unit/test_xaprintf.c index d66fa67f8..995a29e00 100644 --- a/tests/unit/test_xaprintf.c +++ b/tests/unit/test_xaprintf.c @@ -2,7 +2,7 @@ // SPDX-License-Identifier: BSD-3-Clause -#include "string/sprintf/xaprintf.h" +#include "string/sprintf/aprintf.h" #include #include -- 2.47.3