]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/alloc/, lib/, src/, tests/: Organize the allocation APIs in a new subdirectory
authorAlejandro Colomar <alx@kernel.org>
Thu, 27 Jun 2024 14:42:54 +0000 (16:42 +0200)
committerSerge Hallyn <serge@hallyn.com>
Tue, 2 Jul 2024 02:40:11 +0000 (21:40 -0500)
Signed-off-by: Alejandro Colomar <alx@kernel.org>
60 files changed:
lib/Makefile.am
lib/addgrps.c
lib/agetpass.c
lib/alloc.c [deleted file]
lib/alloc.h [deleted file]
lib/alloc/calloc.c [new file with mode: 0644]
lib/alloc/calloc.h [new file with mode: 0644]
lib/alloc/malloc.c [new file with mode: 0644]
lib/alloc/malloc.h [new file with mode: 0644]
lib/alloc/realloc.c [new file with mode: 0644]
lib/alloc/realloc.h [new file with mode: 0644]
lib/alloc/reallocf.c [new file with mode: 0644]
lib/alloc/reallocf.h [new file with mode: 0644]
lib/alloc/x/xcalloc.c [new file with mode: 0644]
lib/alloc/x/xcalloc.h [new file with mode: 0644]
lib/alloc/x/xmalloc.c [new file with mode: 0644]
lib/alloc/x/xmalloc.h [new file with mode: 0644]
lib/alloc/x/xrealloc.c [new file with mode: 0644]
lib/alloc/x/xrealloc.h [new file with mode: 0644]
lib/commonio.c
lib/copydir.c
lib/env.c
lib/find_new_gid.c
lib/find_new_uid.c
lib/getdef.c
lib/groupio.c
lib/groupmem.c
lib/gshadow.c
lib/idmapping.c
lib/list.c
lib/loginprompt.c
lib/mail.c
lib/nss.c
lib/pam_pass_non_interactive.c
lib/prefix_flag.c
lib/pwmem.c
lib/run_part.c
lib/sgetgrent.c
lib/sgroupio.c
lib/shadowmem.c
lib/sssd.c
lib/string/strdup/xstrdup.h
lib/string/strdup/xstrndup.h
lib/subordinateio.c
lib/utmp.c
lib/xgetXXbyYY.c
src/gpasswd.c
src/groupmems.c
src/groupmod.c
src/groups.c
src/id.c
src/login.c
src/newgrp.c
src/newusers.c
src/su.c
src/useradd.c
src/usermod.c
src/vipw.c
tests/libsubid/04_nss/libsubid_zzz.c
tests/unit/test_chkname.c

index 231ed326e5fa2b15be601c92c4e36f505eb38e2a..fb509555d6cffbc263b7698b6e60943e5153c835 100644 (file)
@@ -29,8 +29,20 @@ libshadow_la_SOURCES = \
        age.c \
        agetpass.c \
        agetpass.h \
-       alloc.c \
-       alloc.h \
+       alloc/calloc.c \
+       alloc/calloc.h \
+       alloc/malloc.c \
+       alloc/malloc.h \
+       alloc/realloc.c \
+       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.c \
        atoi/a2i.h \
        atoi/getnum.c \
index dae3dba2e8900eb15a49ed4dd0ca69cca0ea5fc6..b2e17a9ddf09144b43be2e83457b35284d9cd802 100644 (file)
@@ -18,7 +18,8 @@
 #include <grp.h>
 #include <errno.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
+#include "alloc/reallocf.h"
 #include "shadowlog.h"
 
 #ident "$Id$"
index 5d9f9286d353c37197381dcec6e8501593e3cfb6..ecf40da95f919fcbe514255038a26aed17afb86c 100644 (file)
@@ -16,7 +16,7 @@
 
 #ident "$Id$"
 
-#include "alloc.h"
+#include "alloc/malloc.h"
 
 #if WITH_LIBBSD == 0
 #include "freezero.h"
diff --git a/lib/alloc.c b/lib/alloc.c
deleted file mode 100644 (file)
index 918f950..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
-// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
-// SPDX-FileCopyrightText: 2003-2006, Tomasz Kłoczko
-// SPDX-FileCopyrightText: 2008     , Nicolas François
-// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
-// SPDX-License-Identifier: BSD-3-Clause
-
-/* Replacements for malloc and strdup with error checking.  Too trivial
-   to be worth copyrighting :-).  I did that because a lot of code used
-   malloc and strdup without checking for NULL pointer, and I like some
-   message better than a core dump...  --marekm
-
-   Yeh, but.  Remember that bailing out might leave the system in some
-   bizarre state.  You really want to put in error checking, then add
-   some back-out failure recovery code. -- jfh */
-
-#include <config.h>
-
-#include "alloc.h"
-
-#include <errno.h>
-#include <stddef.h>
-#include <stdio.h>
-
-#include "defines.h"
-#include "prototypes.h"
-#include "shadowlog.h"
-
-
-extern inline void *xmallocarray(size_t nmemb, size_t size);
-extern inline void *mallocarray(size_t nmemb, size_t size);
-extern inline void *reallocarrayf(void *p, size_t nmemb, size_t size);
-
-
-void *
-xcalloc(size_t nmemb, size_t size)
-{
-       void  *p;
-
-       p = calloc(nmemb, size);
-       if (p == NULL)
-               goto x;
-
-       return p;
-
-x:
-       fprintf(log_get_logfd(), _("%s: %s\n"),
-               log_get_progname(), strerror(errno));
-       exit(13);
-}
-
-
-void *
-xreallocarray(void *p, size_t nmemb, size_t size)
-{
-       p = reallocarrayf(p, nmemb, size);
-       if (p == NULL)
-               goto x;
-
-       return p;
-
-x:
-       fprintf(log_get_logfd(), _("%s: %s\n"),
-               log_get_progname(), strerror(errno));
-       exit(13);
-}
diff --git a/lib/alloc.h b/lib/alloc.h
deleted file mode 100644 (file)
index 37afe50..0000000
+++ /dev/null
@@ -1,82 +0,0 @@
-// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
-// SPDX-License-Identifier: BSD-3-Clause
-
-
-#ifndef SHADOW_INCLUDE_LIB_MALLOC_H_
-#define SHADOW_INCLUDE_LIB_MALLOC_H_
-
-
-#include <config.h>
-
-#include <assert.h>
-#include <errno.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-
-#include "attr.h"
-
-
-#define CALLOC(n, type)   ((type *) calloc(n, sizeof(type)))
-#define XCALLOC(n, type)  ((type *) xcalloc(n, sizeof(type)))
-#define MALLOC(n, type)   ((type *) mallocarray(n, sizeof(type)))
-#define XMALLOC(n, type)  ((type *) xmallocarray(n, sizeof(type)))
-
-#define REALLOC(ptr, n, type)                                                 \
-(                                                                             \
-       _Generic(ptr, type *:  (type *) reallocarray(ptr, n, sizeof(type)))   \
-)
-
-#define REALLOCF(ptr, n, type)                                                \
-(                                                                             \
-       _Generic(ptr, type *:  (type *) reallocarrayf(ptr, n, sizeof(type)))  \
-)
-
-#define XREALLOC(ptr, n, type)                                                \
-(                                                                             \
-       _Generic(ptr, type *:  (type *) xreallocarray(ptr, n, sizeof(type)))  \
-)
-
-
-ATTR_MALLOC(free)
-inline void *xmallocarray(size_t nmemb, size_t size);
-ATTR_MALLOC(free)
-inline void *mallocarray(size_t nmemb, size_t size);
-ATTR_MALLOC(free)
-inline void *reallocarrayf(void *p, size_t nmemb, size_t size);
-
-ATTR_MALLOC(free)
-void *xcalloc(size_t nmemb, size_t size);
-ATTR_MALLOC(free)
-void *xreallocarray(void *p, size_t nmemb, size_t size);
-
-
-inline void *
-xmallocarray(size_t nmemb, size_t size)
-{
-       return xreallocarray(NULL, nmemb, size);
-}
-
-
-inline void *
-mallocarray(size_t nmemb, size_t size)
-{
-       return reallocarray(NULL, nmemb, size);
-}
-
-
-inline void *
-reallocarrayf(void *p, size_t nmemb, size_t size)
-{
-       void  *q;
-
-       q = reallocarray(p, nmemb, size);
-
-       /* realloc(p, 0) is equivalent to free(p);  avoid double free.  */
-       if (q == NULL && nmemb != 0 && size != 0)
-               free(p);
-       return q;
-}
-
-
-#endif  // include guard
diff --git a/lib/alloc/calloc.c b/lib/alloc/calloc.c
new file mode 100644 (file)
index 0000000..55baafd
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2006, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008     , Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "alloc/calloc.h"
diff --git a/lib/alloc/calloc.h b/lib/alloc/calloc.h
new file mode 100644 (file)
index 0000000..5c09343
--- /dev/null
@@ -0,0 +1,17 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ALLOC_CALLOC_H_
+#define SHADOW_INCLUDE_LIB_ALLOC_CALLOC_H_
+
+
+#include <config.h>
+
+#include <stdlib.h>
+
+
+#define CALLOC(n, type)   ((type *) calloc(n, sizeof(type)))
+
+
+#endif  // include guard
diff --git a/lib/alloc/malloc.c b/lib/alloc/malloc.c
new file mode 100644 (file)
index 0000000..453f32d
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2006, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008     , Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "alloc/malloc.h"
+
+#include <stddef.h>
+
+
+extern inline void *mallocarray(size_t nmemb, size_t size);
diff --git a/lib/alloc/malloc.h b/lib/alloc/malloc.h
new file mode 100644 (file)
index 0000000..5badeeb
--- /dev/null
@@ -0,0 +1,30 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ALLOC_MALLOC_H_
+#define SHADOW_INCLUDE_LIB_ALLOC_MALLOC_H_
+
+
+#include <config.h>
+
+#include <stdlib.h>
+
+#include "attr.h"
+
+
+#define MALLOC(n, type)   ((type *) mallocarray(n, sizeof(type)))
+
+
+ATTR_MALLOC(free)
+inline void *mallocarray(size_t nmemb, size_t size);
+
+
+inline void *
+mallocarray(size_t nmemb, size_t size)
+{
+       return reallocarray(NULL, nmemb, size);
+}
+
+
+#endif  // include guard
diff --git a/lib/alloc/realloc.c b/lib/alloc/realloc.c
new file mode 100644 (file)
index 0000000..ecdc398
--- /dev/null
@@ -0,0 +1,11 @@
+// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2006, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008     , Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "alloc/realloc.h"
diff --git a/lib/alloc/realloc.h b/lib/alloc/realloc.h
new file mode 100644 (file)
index 0000000..5ed9078
--- /dev/null
@@ -0,0 +1,20 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ALLOC_REALLOC_H_
+#define SHADOW_INCLUDE_LIB_ALLOC_REALLOC_H_
+
+
+#include <config.h>
+
+#include <stdlib.h>
+
+
+#define REALLOC(ptr, n, type)                                                 \
+(                                                                             \
+       _Generic(ptr, type *:  (type *) reallocarray(ptr, n, sizeof(type)))   \
+)
+
+
+#endif  // include guard
diff --git a/lib/alloc/reallocf.c b/lib/alloc/reallocf.c
new file mode 100644 (file)
index 0000000..953cf7e
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2006, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008     , Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "alloc/reallocf.h"
+
+#include <stddef.h>
+
+
+extern inline void *reallocarrayf(void *p, size_t nmemb, size_t size);
diff --git a/lib/alloc/reallocf.h b/lib/alloc/reallocf.h
new file mode 100644 (file)
index 0000000..cb90fb3
--- /dev/null
@@ -0,0 +1,41 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ALLOC_REALLOCF_H_
+#define SHADOW_INCLUDE_LIB_ALLOC_REALLOCF_H_
+
+
+#include <config.h>
+
+#include <stddef.h>
+#include <stdlib.h>
+
+#include "attr.h"
+
+
+#define REALLOCF(ptr, n, type)                                                \
+(                                                                             \
+       _Generic(ptr, type *:  (type *) reallocarrayf(ptr, n, sizeof(type)))  \
+)
+
+
+ATTR_MALLOC(free)
+inline void *reallocarrayf(void *p, size_t nmemb, size_t size);
+
+
+inline void *
+reallocarrayf(void *p, size_t nmemb, size_t size)
+{
+       void  *q;
+
+       q = reallocarray(p, nmemb, size);
+
+       /* realloc(p, 0) is equivalent to free(p);  avoid double free.  */
+       if (q == NULL && nmemb != 0 && size != 0)
+               free(p);
+       return q;
+}
+
+
+#endif  // include guard
diff --git a/lib/alloc/x/xcalloc.c b/lib/alloc/x/xcalloc.c
new file mode 100644 (file)
index 0000000..672d5ee
--- /dev/null
@@ -0,0 +1,36 @@
+// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2006, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008     , Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "alloc/x/xcalloc.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "defines.h"
+#include "shadowlog.h"
+
+
+void *
+xcalloc(size_t nmemb, size_t size)
+{
+       void  *p;
+
+       p = calloc(nmemb, size);
+       if (p == NULL)
+               goto x;
+
+       return p;
+
+x:
+       fprintf(log_get_logfd(), _("%s: %s\n"),
+               log_get_progname(), strerror(errno));
+       exit(13);
+}
diff --git a/lib/alloc/x/xcalloc.h b/lib/alloc/x/xcalloc.h
new file mode 100644 (file)
index 0000000..b78d104
--- /dev/null
@@ -0,0 +1,24 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// 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 <stddef.h>
+#include <stdlib.h>
+
+#include "attr.h"
+
+
+#define XCALLOC(n, type)  ((type *) xcalloc(n, sizeof(type)))
+
+
+ATTR_MALLOC(free)
+void *xcalloc(size_t nmemb, size_t size);
+
+
+#endif  // include guard
diff --git a/lib/alloc/x/xmalloc.c b/lib/alloc/x/xmalloc.c
new file mode 100644 (file)
index 0000000..223da9a
--- /dev/null
@@ -0,0 +1,16 @@
+// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2006, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008     , Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "alloc/x/xmalloc.h"
+
+#include <stddef.h>
+
+
+extern inline void *xmallocarray(size_t nmemb, size_t size);
diff --git a/lib/alloc/x/xmalloc.h b/lib/alloc/x/xmalloc.h
new file mode 100644 (file)
index 0000000..967e18b
--- /dev/null
@@ -0,0 +1,31 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// 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 <stddef.h>
+
+#include "alloc/x/xrealloc.h"
+#include "attr.h"
+
+
+#define XMALLOC(n, type)  ((type *) xmallocarray(n, sizeof(type)))
+
+
+ATTR_MALLOC(free)
+inline void *xmallocarray(size_t nmemb, size_t size);
+
+
+inline void *
+xmallocarray(size_t nmemb, size_t size)
+{
+       return xreallocarray(NULL, nmemb, size);
+}
+
+
+#endif  // include guard
diff --git a/lib/alloc/x/xrealloc.c b/lib/alloc/x/xrealloc.c
new file mode 100644 (file)
index 0000000..76887f9
--- /dev/null
@@ -0,0 +1,35 @@
+// SPDX-FileCopyrightText: 1990-1994, Julianne Frances Haugh
+// SPDX-FileCopyrightText: 1996-1998, Marek Michałkiewicz
+// SPDX-FileCopyrightText: 2003-2006, Tomasz Kłoczko
+// SPDX-FileCopyrightText: 2008     , Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "alloc/x/xrealloc.h"
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "alloc/reallocf.h"
+#include "defines.h"
+#include "shadowlog.h"
+
+
+void *
+xreallocarray(void *p, size_t nmemb, size_t size)
+{
+       p = reallocarrayf(p, nmemb, size);
+       if (p == NULL)
+               goto x;
+
+       return p;
+
+x:
+       fprintf(log_get_logfd(), _("%s: %s\n"),
+               log_get_progname(), strerror(errno));
+       exit(13);
+}
diff --git a/lib/alloc/x/xrealloc.h b/lib/alloc/x/xrealloc.h
new file mode 100644 (file)
index 0000000..fa2d6f1
--- /dev/null
@@ -0,0 +1,30 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_MALLOC_H_
+#define SHADOW_INCLUDE_LIB_MALLOC_H_
+
+
+#include <config.h>
+
+#include <assert.h>
+#include <errno.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+
+#include "attr.h"
+
+
+#define XREALLOC(ptr, n, type)                                                \
+(                                                                             \
+       _Generic(ptr, type *:  (type *) xreallocarray(ptr, n, sizeof(type)))  \
+)
+
+
+ATTR_MALLOC(free)
+void *xreallocarray(void *p, size_t nmemb, size_t size);
+
+
+#endif  // include guard
index 11e4f3c0ff8e18303503acd94178d9d6b52080dc..7bc7067070146127e0993a20340056b5161eb9e9 100644 (file)
@@ -22,7 +22,8 @@
 #include <stdlib.h>
 #include <utime.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
+#include "alloc/reallocf.h"
 #include "atoi/getnum.h"
 #include "commonio.h"
 #include "defines.h"
index 58d7cb8cdbbe6d70d50a8bf4f5a1ee144db3aa62..ae48d10eb54858ade144a28379b9cb51bb2ff4aa 100644 (file)
@@ -18,7 +18,8 @@
 #include <fcntl.h>
 #include <stdio.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
+#include "alloc/x/xmalloc.h"
 #include "attr.h"
 #include "prototypes.h"
 #include "defines.h"
index 2debf35c2b26455e34d241e53fc3f2d334808bb3..9cb3137122b8d1322ec7d6b9a592a479ea35c20e 100644 (file)
--- a/lib/env.c
+++ b/lib/env.c
@@ -16,7 +16,8 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
+#include "alloc/x/xrealloc.h"
 #include "prototypes.h"
 #include "defines.h"
 #include "shadowlog.h"
index cfd560982f6d528a0a80c3edfac0dbaa3c920ba6..5c2b855da8706b5c454b46e53b8c2781b6d7d3f0 100644 (file)
@@ -12,7 +12,7 @@
 #include <stdio.h>
 #include <errno.h>
 
-#include "alloc.h"
+#include "alloc/calloc.h"
 #include "prototypes.h"
 #include "groupio.h"
 #include "getdef.h"
index 45ce712c939146b75626af63ec98e85293ee0c7e..01f63bbfec226e4e9dcf55dda164ff314c82acab 100644 (file)
@@ -12,7 +12,7 @@
 #include <stdio.h>
 #include <errno.h>
 
-#include "alloc.h"
+#include "alloc/calloc.h"
 #include "prototypes.h"
 #include "pwio.h"
 #include "getdef.h"
index 347a7f524b8360216902b1142f087f3d62f0956e..c6f669df6434e96d255033164ccd2a16433d954f 100644 (file)
@@ -22,7 +22,6 @@
 #include <libeconf.h>
 #endif
 
-#include "alloc.h"
 #include "atoi/str2i.h"
 #include "defines.h"
 #include "getdef.h"
index 7b9d45f2ca69d84f0688431ef28ce10af928d3ff..3984b4af5be2341c8c1615887cf49a4f64d42d94 100644 (file)
@@ -15,7 +15,8 @@
 #include <assert.h>
 #include <stdio.h>
 
-#include "alloc.h"
+#include "alloc/calloc.h"
+#include "alloc/malloc.h"
 #include "prototypes.h"
 #include "defines.h"
 #include "commonio.h"
index 69d4435be5807f4b1067565c0a18685d97e1b1f7..b849ba562590701eeb2c7e2bedd3b5ebe4b32d01 100644 (file)
@@ -12,7 +12,8 @@
 
 #ident "$Id$"
 
-#include "alloc.h"
+#include "alloc/calloc.h"
+#include "alloc/malloc.h"
 #include "memzero.h"
 #include "prototypes.h"
 #include "defines.h"
index b551c4cf19f00eb5e067a5db51e215f704b0aa50..c26d8a3c5c92abc7e85c5e959615cb4e19f9c627 100644 (file)
@@ -17,7 +17,8 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
+#include "alloc/realloc.h"
 #include "prototypes.h"
 #include "defines.h"
 
index b74fc2da9337f6746be7b0ae0598001f32f42e17..fe3ccdfe38c08583bccbfd85dac87db25cd96fa9 100644 (file)
@@ -13,7 +13,8 @@
 #include <stdio.h>
 #include <strings.h>
 
-#include "alloc.h"
+#include "alloc/calloc.h"
+#include "alloc/x/xmalloc.h"
 #include "atoi/str2i.h"
 #include "prototypes.h"
 #include "string/sprintf/stpeprintf.h"
index 8604cb63ed127239878a6891d24d5e54759dc829..1132c5c7e4c2c8ccd700e7407402d48c4af0cb88 100644 (file)
@@ -12,7 +12,7 @@
 
 #include <assert.h>
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "prototypes.h"
 #include "defines.h"
 #include "string/strdup/xstrdup.h"
index 9b2aa25c2d1d37d010db4e89e47a470d7df36fc1..7c753180340bfae94235937bfc2814c5bf9cd59d 100644 (file)
@@ -15,7 +15,6 @@
 #include <stdio.h>
 #include <signal.h>
 
-#include "alloc.h"
 #include "attr.h"
 #include "memzero.h"
 #include "prototypes.h"
index 9bbab2699ee3c112dd47ffb44a6ee62e207a6b0d..b62287e6a51892c12bf862e37962d1c7608334cf 100644 (file)
@@ -15,7 +15,6 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "alloc.h"
 #include "getdef.h"
 #include "string/sprintf/xasprintf.h"
 
index 80f5e544f223538a7b402d755f7da29c2600d82f..7be9d63c1a3a7773bbb5721d4d7de51fa5a85ee7 100644 (file)
--- a/lib/nss.c
+++ b/lib/nss.c
@@ -9,7 +9,7 @@
 #include <ctype.h>
 #include <stdatomic.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
 #include "prototypes.h"
 #include "../libsubid/subid.h"
 #include "shadowlog_internal.h"
index 3d10908bdf13d856e48bef82edf72e57f72cf964..072752630db5ebe28f8a639684e579b2ecf06826 100644 (file)
@@ -17,7 +17,7 @@
 
 #include <security/pam_appl.h>
 
-#include "alloc.h"
+#include "alloc/calloc.h"
 #include "attr.h"
 #include "memzero.h"
 #include "prototypes.h"
index 3213febdda9992c549f61e3c9f54ae1148c673b2..57d24332b0f63acf4bd59fbbd2e659676f000de8 100644 (file)
@@ -14,7 +14,6 @@
 
 #include "atoi/getnum.h"
 #include "defines.h"
-#include "alloc.h"
 #include "prototypes.h"
 /*@-exitarg@*/
 #include "exitcodes.h"
index 9c6e58d7e80ae3999b3be92a675c9f357b392e02..16e07a2c9a71908cbfa993a7c8abba14cc463f1d 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <stdio.h>
 
-#include "alloc.h"
+#include "alloc/calloc.h"
 #include "defines.h"
 #include "memzero.h"
 #include "prototypes.h"
index 670d8150d1d5666b912bdaba42b41235dc6a890e..2514e15f3c1b102fb411fce9a85396732952e757 100644 (file)
@@ -11,7 +11,6 @@
 #include <unistd.h>
 #include <lib/prototypes.h>
 
-#include "alloc.h"
 #include "run_part.h"
 #include "shadowlog_internal.h"
 
index b6db471166c6f6d536aa435d09d1df80d4379422..f62f6973cba482526fff222e5e3133810eb21bd5 100644 (file)
@@ -16,7 +16,8 @@
 #include <grp.h>
 #include <string.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
+#include "alloc/reallocf.h"
 #include "atoi/getnum.h"
 #include "defines.h"
 #include "prototypes.h"
index 0297df4ae4b93eeeb0686bd039e7514d5580f122..08d30ba415cf18141c12a28e686ca8d0adb2ef5e 100644 (file)
@@ -14,7 +14,8 @@
 
 #ident "$Id$"
 
-#include "alloc.h"
+#include "alloc/calloc.h"
+#include "alloc/malloc.h"
 #include "prototypes.h"
 #include "defines.h"
 #include "commonio.h"
index 9d8f193b251f01e430e1f3adfacb1592a660477b..284cff65810aa44c5e9930c79753d74babb17794 100644 (file)
@@ -17,7 +17,7 @@
 #include <shadow.h>
 #include <stdio.h>
 
-#include "alloc.h"
+#include "alloc/calloc.h"
 #include "memzero.h"
 #include "shadowio.h"
 
index fadb378ded456eab1e104db73c773afaeed87cb7..0a92144bc5662a3007db7b6e5e5faa783586433f 100644 (file)
@@ -8,7 +8,7 @@
 #include <sys/wait.h>
 #include <sys/types.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
 #include "exitcodes.h"
 #include "defines.h"
 #include "prototypes.h"
index 13164182ca74ed2da19a8675eec5a88e9652eb04..ba3e2556c7ed5e211051e755581d0f4099b003e0 100644 (file)
@@ -14,7 +14,7 @@
 
 #include <string.h>
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "attr.h"
 
 
index 77fd5206a172455e2728e287d064624f3043f229..88263c30099a11dbe602fd14e9316d689b5517c3 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <string.h>
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "sizeof.h"
 #include "string/strcpy/strncat.h"
 
index 9dd7702ab0ef0920edf1d35442fad916c8fa290a..c417e71976be915c0fc6d3e5aa8bb6d35a911c8c 100644 (file)
@@ -18,7 +18,9 @@
 #include <fcntl.h>
 #include <string.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
+#include "alloc/realloc.h"
+#include "alloc/reallocf.h"
 #include "atoi/str2i.h"
 #include "string/sprintf/snprintf.h"
 
index ba80f7fd726f137beedf66a3a73a156016199e20..e8f9c793767a7c6700ce5b832aa4da704a567cc2 100644 (file)
@@ -22,7 +22,8 @@
 #include <stdio.h>
 #include <fcntl.h>
 
-#include "alloc.h"
+#include "alloc/x/xcalloc.h"
+#include "alloc/x/xmalloc.h"
 #include "sizeof.h"
 #include "string/strcpy/strncpy.h"
 #include "string/strcpy/strtcpy.h"
index 7d5e914e199f72ead071ea0c2c805cfcf18e3367..01976fe72631288ec1efad05f738d69569407903 100644 (file)
@@ -31,7 +31,8 @@
 #include <stdio.h>
 #include <errno.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
+#include "alloc/x/xrealloc.h"
 #include "prototypes.h"
 #include "shadowlog.h"
 
index 70d7547fe41f98cec860ccf1bcf5a75932d6bf65..83e56a0e7fc411532dc85202b6bf4e3260547ba1 100644 (file)
@@ -21,7 +21,7 @@
 #include <sys/types.h>
 
 #include "agetpass.h"
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "attr.h"
 #include "defines.h"
 #include "groupio.h"
index 444882cca8b79cbdea3a5a7a11434d8e303e6439..7edbd2fe8822540b00ba9cfc735ddf0220b4195e 100644 (file)
@@ -19,7 +19,7 @@
 #endif                         /* USE_PAM */
 #include <pwd.h>
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "defines.h"
 #include "prototypes.h"
 #include "groupio.h"
index 3f6d54eb6ff9df467f804147153dab0f917a0256..15a673c5d62a52a87f902411e9eac19d331ab466 100644 (file)
@@ -26,7 +26,7 @@
 #endif                         /* USE_PAM */
 #endif                         /* ACCT_TOOLS_SETUID */
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "atoi/getnum.h"
 #include "chkname.h"
 #include "defines.h"
index d19a80a35d4a2dba6e5d5330fee5b9665facd2dd..5c9ce4638998b5414ebe072928b4c425659a66d1 100644 (file)
@@ -15,7 +15,7 @@
 #include <pwd.h>
 #include <stdio.h>
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "defines.h"
 #include "prototypes.h"
 #include "shadowlog.h"
index 673693e0b0059f8a34cf14ccf1dad0d2e5266c1c..247af6d9985ca56e363c05db71ae136b5ed7daef 100644 (file)
--- a/src/id.c
+++ b/src/id.c
@@ -24,7 +24,7 @@
 #include <stdio.h>
 #include <sys/types.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
 #include "defines.h"
 
 /* local function prototypes */
index 338c1a4336f8c4c95e7510055efe253e5752b2cc..cf1753e4235f60372c6684089fc78a2c2920a3b5 100644 (file)
@@ -25,7 +25,7 @@
 #include <sys/ioctl.h>
 #include <assert.h>
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "attr.h"
 #include "chkname.h"
 #include "defines.h"
index 6542abf24fd2950400fa7642e63d20c1cf99c731..88d97758f433244b96b448dff11674f0515c3b08 100644 (file)
@@ -18,7 +18,7 @@
 #include <assert.h>
 
 #include "agetpass.h"
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "defines.h"
 #include "getdef.h"
 #include "prototypes.h"
index e5d20491ed29f753a71f197a24aba24be3423add..4f7b96fa87b96630d8b47a6a19a1c76e6c1a0f08 100644 (file)
@@ -30,7 +30,7 @@
 #include <errno.h>
 #include <string.h>
 
-#include "alloc.h"
+#include "alloc/reallocf.h"
 #include "atoi/getnum.h"
 #include "atoi/str2i.h"
 #ifdef ACCT_TOOLS_SETUID
index 4e0d4100e617cc88db52265dbb4b6804660c1c50..40e8189f95871b5149343381d01ff966ab5f40fb 100644 (file)
--- a/src/su.c
+++ b/src/su.c
@@ -46,7 +46,7 @@
 #include <fcntl.h>
 #endif                         /* !USE_PAM */
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "attr.h"
 #include "cast.h"
 #include "prototypes.h"
index 4db0aa3a5610fbcf55a680ad54fb8a6f948d9deb..9b4852265583eeae7acf42fe54ffa924fa43b5db 100644 (file)
@@ -36,7 +36,7 @@
 #include <time.h>
 #include <unistd.h>
 
-#include "alloc.h"
+#include "alloc/x/xmalloc.h"
 #include "atoi/str2i.h"
 #include "atoi/getnum.h"
 #include "chkname.h"
index b688ee8edef5199ba3b0f10abfffe1ff635807a1..f80c056fd615699ccc20f100262bae4581b3798c 100644 (file)
@@ -32,7 +32,8 @@
 #include <sys/types.h>
 #include <time.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
+#include "alloc/x/xmalloc.h"
 #include "atoi/a2i.h"
 #include "atoi/getnum.h"
 #include "atoi/str2i.h"
index 5d8d1c2e86e167bad186842f443ebee39e4417fa..31c3b7795f3e01e3f456c13e2295926df7ada433 100644 (file)
@@ -27,7 +27,6 @@
 #include <unistd.h>
 #include <utime.h>
 
-#include "alloc.h"
 #include "defines.h"
 #include "getdef.h"
 #include "groupio.h"
index 5ba3df95ac1ca6b00d30a035b5932e9c4dbf1df8..d8141ba3b1ee3bdcf5f9ad4ff31b73f886c7c83e 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdbool.h>
 #include <subid.h>
 #include <string.h>
-#include "alloc.h"
+#include "alloc/malloc.h"
 
 enum subid_status shadow_subid_has_any_range(const char *owner, enum subid_type t, bool *result)
 {
index e0f9f84b45f39ecb3c4357d8b24e47cf135ee699..127114dcbc87197cc9553ee139ddc1a7034ee985 100644 (file)
@@ -16,7 +16,7 @@
 #include <stdint.h>  // Required by <cmocka.h>
 #include <cmocka.h>
 
-#include "alloc.h"
+#include "alloc/malloc.h"
 #include "chkname.h"