]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/atoi/, *: Split files
authorAlejandro Colomar <alx@kernel.org>
Sun, 30 Jun 2024 00:18:55 +0000 (02:18 +0200)
committerSerge Hallyn <serge@hallyn.com>
Fri, 12 Jul 2024 03:42:58 +0000 (22:42 -0500)
56 files changed:
lib/Makefile.am
lib/atoi/a2i.c [deleted file]
lib/atoi/a2i.h [deleted file]
lib/atoi/a2i/a2i.c [new file with mode: 0644]
lib/atoi/a2i/a2i.h [new file with mode: 0644]
lib/atoi/a2i/a2s.c [new file with mode: 0644]
lib/atoi/a2i/a2s.h [new file with mode: 0644]
lib/atoi/a2i/a2s_c.c [new file with mode: 0644]
lib/atoi/a2i/a2s_c.h [new file with mode: 0644]
lib/atoi/a2i/a2s_nc.c [new file with mode: 0644]
lib/atoi/a2i/a2s_nc.h [new file with mode: 0644]
lib/atoi/a2i/a2u.c [new file with mode: 0644]
lib/atoi/a2i/a2u.h [new file with mode: 0644]
lib/atoi/a2i/a2u_c.c [new file with mode: 0644]
lib/atoi/a2i/a2u_c.h [new file with mode: 0644]
lib/atoi/a2i/a2u_nc.c [new file with mode: 0644]
lib/atoi/a2i/a2u_nc.h [new file with mode: 0644]
lib/atoi/getnum.h
lib/atoi/str2i.h [deleted file]
lib/atoi/str2i/str2i.c [new file with mode: 0644]
lib/atoi/str2i/str2i.h [new file with mode: 0644]
lib/atoi/str2i/str2s.c [new file with mode: 0644]
lib/atoi/str2i/str2s.h [new file with mode: 0644]
lib/atoi/str2i/str2u.c [moved from lib/atoi/str2i.c with 62% similarity]
lib/atoi/str2i/str2u.h [new file with mode: 0644]
lib/atoi/strtoi.c [deleted file]
lib/atoi/strtoi.h [deleted file]
lib/atoi/strtoi/strtoi.c [new file with mode: 0644]
lib/atoi/strtoi/strtoi.h [new file with mode: 0644]
lib/atoi/strtoi/strtou.c [new file with mode: 0644]
lib/atoi/strtoi/strtou.h [new file with mode: 0644]
lib/atoi/strtoi/strtou_noneg.c [moved from lib/atoi/strtou_noneg.c with 67% similarity]
lib/atoi/strtoi/strtou_noneg.h [moved from lib/atoi/strtou_noneg.h with 73% similarity]
lib/getdef.c
lib/getrange.c
lib/gettime.c
lib/idmapping.c
lib/limits.c
lib/sgetspent.c
lib/shadow.c
lib/strtoday.c
lib/subordinateio.c
src/chage.c
src/check_subid_range.c
src/chgpasswd.c
src/chpasswd.c
src/faillog.c
src/free_subid_range.c
src/lastlog.c
src/new_subid_range.c
src/newusers.c
src/passwd.c
src/useradd.c
src/usermod.c
tests/unit/Makefile.am
tests/unit/test_atoi_strtoi.c

index 184b3d4534a998a4275bded90e75eeb0a730d3b2..4b02764d3c6110c8f7a0dd47ff085c7f41e19d12 100644 (file)
@@ -43,16 +43,34 @@ libshadow_la_SOURCES = \
        alloc/x/xmalloc.h \
        alloc/x/xrealloc.c \
        alloc/x/xrealloc.h \
-       atoi/a2i.c \
-       atoi/a2i.h \
+       atoi/a2i/a2i.c \
+       atoi/a2i/a2i.h \
+       atoi/a2i/a2s.c \
+       atoi/a2i/a2s.h \
+       atoi/a2i/a2s_c.c \
+       atoi/a2i/a2s_c.h \
+       atoi/a2i/a2s_nc.c \
+       atoi/a2i/a2s_nc.h \
+       atoi/a2i/a2u.c \
+       atoi/a2i/a2u.h \
+       atoi/a2i/a2u_c.c \
+       atoi/a2i/a2u_c.h \
+       atoi/a2i/a2u_nc.c \
+       atoi/a2i/a2u_nc.h \
        atoi/getnum.c \
        atoi/getnum.h \
-       atoi/str2i.c \
-       atoi/str2i.h \
-       atoi/strtoi.c \
-       atoi/strtoi.h \
-       atoi/strtou_noneg.c \
-       atoi/strtou_noneg.h \
+       atoi/str2i/str2i.c \
+       atoi/str2i/str2i.h \
+       atoi/str2i/str2s.c \
+       atoi/str2i/str2s.h \
+       atoi/str2i/str2u.c \
+       atoi/str2i/str2u.h \
+       atoi/strtoi/strtoi.c \
+       atoi/strtoi/strtoi.h \
+       atoi/strtoi/strtou.c \
+       atoi/strtoi/strtou.h \
+       atoi/strtoi/strtou_noneg.c \
+       atoi/strtoi/strtou_noneg.h \
        attr.h \
        audit_help.c \
        basename.c \
diff --git a/lib/atoi/a2i.c b/lib/atoi/a2i.c
deleted file mode 100644 (file)
index a2cf872..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
-// SPDX-License-Identifier: BSD-3-Clause
-
-
-#include <config.h>
-
-#include "atoi/a2i.h"
-
-
-extern inline int a2sh_c(short *restrict n, const char *s,
-    const char **restrict endp, int base, short min, short max);
-extern inline int a2si_c(int *restrict n, const char *s,
-    const char **restrict endp, int base, int min, int max);
-extern inline int a2sl_c(long *restrict n, const char *s,
-    const char **restrict endp, int base, long min, long max);
-extern inline int a2sll_c(long long *restrict n, const char *s,
-    const char **restrict endp, int base, long long min, long long max);
-extern inline int a2uh_c(unsigned short *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned short min,
-    unsigned short max);
-extern inline int a2ui_c(unsigned int *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned int min, unsigned int max);
-extern inline int a2ul_c(unsigned long *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned long min, unsigned long max);
-extern inline int a2ull_c(unsigned long long *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned long long min,
-    unsigned long long max);
-
-
-extern inline int a2sh_nc(short *restrict n, char *s,
-    char **restrict endp, int base, short min, short max);
-extern inline int a2si_nc(int *restrict n, char *s,
-    char **restrict endp, int base, int min, int max);
-extern inline int a2sl_nc(long *restrict n, char *s,
-    char **restrict endp, int base, long min, long max);
-extern inline int a2sll_nc(long long *restrict n, char *s,
-    char **restrict endp, int base, long long min, long long max);
-extern inline int a2uh_nc(unsigned short *restrict n, char *s,
-    char **restrict endp, int base, unsigned short min, unsigned short max);
-extern inline int a2ui_nc(unsigned int *restrict n, char *s,
-    char **restrict endp, int base, unsigned int min, unsigned int max);
-extern inline int a2ul_nc(unsigned long *restrict n, char *s,
-    char **restrict endp, int base, unsigned long min, unsigned long max);
-extern inline int a2ull_nc(unsigned long long *restrict n, char *s,
-    char **restrict endp, int base, unsigned long long min,
-    unsigned long long max);
diff --git a/lib/atoi/a2i.h b/lib/atoi/a2i.h
deleted file mode 100644 (file)
index 64f775a..0000000
+++ /dev/null
@@ -1,386 +0,0 @@
-// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
-// SPDX-License-Identifier: BSD-3-Clause
-
-
-#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_H_
-#define SHADOW_INCLUDE_LIB_ATOI_A2I_H_
-
-
-#include <config.h>
-
-#include <errno.h>
-
-#include "atoi/strtoi.h"
-#include "atoi/strtou_noneg.h"
-#include "attr.h"
-
-
-/*
- * See the manual of these macros in liba2i's documentation:
- * <http://www.alejandro-colomar.es/share/dist/liba2i/git/HEAD/liba2i-HEAD.pdf>
- */
-
-
-#define a2i(TYPE, n, s, ...)                                                  \
-(                                                                             \
-       _Generic((void (*)(TYPE, typeof(s))) 0,                               \
-               void (*)(short,              const char *):  a2sh_c,          \
-               void (*)(short,              const void *):  a2sh_c,          \
-               void (*)(short,              char *):        a2sh_nc,         \
-               void (*)(short,              void *):        a2sh_nc,         \
-               void (*)(int,                const char *):  a2si_c,          \
-               void (*)(int,                const void *):  a2si_c,          \
-               void (*)(int,                char *):        a2si_nc,         \
-               void (*)(int,                void *):        a2si_nc,         \
-               void (*)(long,               const char *):  a2sl_c,          \
-               void (*)(long,               const void *):  a2sl_c,          \
-               void (*)(long,               char *):        a2sl_nc,         \
-               void (*)(long,               void *):        a2sl_nc,         \
-               void (*)(long long,          const char *):  a2sll_c,         \
-               void (*)(long long,          const void *):  a2sll_c,         \
-               void (*)(long long,          char *):        a2sll_nc,        \
-               void (*)(long long,          void *):        a2sll_nc,        \
-               void (*)(unsigned short,     const char *):  a2uh_c,          \
-               void (*)(unsigned short,     const void *):  a2uh_c,          \
-               void (*)(unsigned short,     char *):        a2uh_nc,         \
-               void (*)(unsigned short,     void *):        a2uh_nc,         \
-               void (*)(unsigned int,       const char *):  a2ui_c,          \
-               void (*)(unsigned int,       const void *):  a2ui_c,          \
-               void (*)(unsigned int,       char *):        a2ui_nc,         \
-               void (*)(unsigned int,       void *):        a2ui_nc,         \
-               void (*)(unsigned long,      const char *):  a2ul_c,          \
-               void (*)(unsigned long,      const void *):  a2ul_c,          \
-               void (*)(unsigned long,      char *):        a2ul_nc,         \
-               void (*)(unsigned long,      void *):        a2ul_nc,         \
-               void (*)(unsigned long long, const char *):  a2ull_c,         \
-               void (*)(unsigned long long, const void *):  a2ull_c,         \
-               void (*)(unsigned long long, char *):        a2ull_nc,        \
-               void (*)(unsigned long long, void *):        a2ull_nc         \
-       )(n, s, __VA_ARGS__)                                                  \
-)
-
-
-#define a2sh(n, s, ...)                                                       \
-(                                                                             \
-       _Generic(s,                                                           \
-               const char *:  a2sh_c,                                        \
-               const void *:  a2sh_c,                                        \
-               char *:        a2sh_nc,                                       \
-               void *:        a2sh_nc                                        \
-       )(n, s, __VA_ARGS__)                                                  \
-)
-
-#define a2si(n, s, ...)                                                       \
-(                                                                             \
-       _Generic(s,                                                           \
-               const char *:  a2si_c,                                        \
-               const void *:  a2si_c,                                        \
-               char *:        a2si_nc,                                       \
-               void *:        a2si_nc                                        \
-       )(n, s, __VA_ARGS__)                                                  \
-)
-
-#define a2sl(n, s, ...)                                                       \
-(                                                                             \
-       _Generic(s,                                                           \
-               const char *:  a2sl_c,                                        \
-               const void *:  a2sl_c,                                        \
-               char *:        a2sl_nc,                                       \
-               void *:        a2sl_nc                                        \
-       )(n, s, __VA_ARGS__)                                                  \
-)
-
-#define a2sll(n, s, ...)                                                      \
-(                                                                             \
-       _Generic(s,                                                           \
-               const char *:  a2sll_c,                                       \
-               const void *:  a2sll_c,                                       \
-               char *:        a2sll_nc,                                      \
-               void *:        a2sll_nc                                       \
-       )(n, s, __VA_ARGS__)                                                  \
-)
-
-#define a2uh(n, s, ...)                                                       \
-(                                                                             \
-       _Generic(s,                                                           \
-               const char *:  a2uh_c,                                        \
-               const void *:  a2uh_c,                                        \
-               char *:        a2uh_nc,                                       \
-               void *:        a2uh_nc                                        \
-       )(n, s, __VA_ARGS__)                                                  \
-)
-
-#define a2ui(n, s, ...)                                                       \
-(                                                                             \
-       _Generic(s,                                                           \
-               const char *:  a2ui_c,                                        \
-               const void *:  a2ui_c,                                        \
-               char *:        a2ui_nc,                                       \
-               void *:        a2ui_nc                                        \
-       )(n, s, __VA_ARGS__)                                                  \
-)
-
-#define a2ul(n, s, ...)                                                       \
-(                                                                             \
-       _Generic(s,                                                           \
-               const char *:  a2ul_c,                                        \
-               const void *:  a2ul_c,                                        \
-               char *:        a2ul_nc,                                       \
-               void *:        a2ul_nc                                        \
-       )(n, s, __VA_ARGS__)                                                  \
-)
-
-#define a2ull(n, s, ...)                                                      \
-(                                                                             \
-       _Generic(s,                                                           \
-               const char *:  a2ull_c,                                       \
-               const void *:  a2ull_c,                                       \
-               char *:        a2ull_nc,                                      \
-               void *:        a2ull_nc                                       \
-       )(n, s, __VA_ARGS__)                                                  \
-)
-
-
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2sh_c(short *restrict n, const char *s,
-    const char **restrict endp, int base, short min, short max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2si_c(int *restrict n, const char *s,
-    const char **restrict endp, int base, int min, int max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2sl_c(long *restrict n, const char *s,
-    const char **restrict endp, int base, long min, long max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2sll_c(long long *restrict n, const char *s,
-    const char **restrict endp, int base, long long min, long long max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2uh_c(unsigned short *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned short min,
-    unsigned short max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2ui_c(unsigned int *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned int min, unsigned int max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2ul_c(unsigned long *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned long min, unsigned long max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2ull_c(unsigned long long *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned long long min,
-    unsigned long long max);
-
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2sh_nc(short *restrict n, char *s,
-    char **restrict endp, int base, short min, short max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2si_nc(int *restrict n, char *s,
-    char **restrict endp, int base, int min, int max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2sl_nc(long *restrict n, char *s,
-    char **restrict endp, int base, long min, long max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2sll_nc(long long *restrict n, char *s,
-    char **restrict endp, int base, long long min, long long max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2uh_nc(unsigned short *restrict n, char *s,
-    char **restrict endp, int base, unsigned short min, unsigned short max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2ui_nc(unsigned int *restrict n, char *s,
-    char **restrict endp, int base, unsigned int min, unsigned int max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2ul_nc(unsigned long *restrict n, char *s,
-    char **restrict endp, int base, unsigned long min, unsigned long max);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
-inline int a2ull_nc(unsigned long long *restrict n, char *s,
-    char **restrict endp, int base, unsigned long long min,
-    unsigned long long max);
-
-
-inline int
-a2sh_c(short *restrict n, const char *s,
-    const char **restrict endp, int base, short min, short max)
-{
-       return a2sh(n, (char *) s, (char **) endp, base, min, max);
-}
-
-
-inline int
-a2si_c(int *restrict n, const char *s,
-    const char **restrict endp, int base, int min, int max)
-{
-       return a2si(n, (char *) s, (char **) endp, base, min, max);
-}
-
-
-inline int
-a2sl_c(long *restrict n, const char *s,
-    const char **restrict endp, int base, long min, long max)
-{
-       return a2sl(n, (char *) s, (char **) endp, base, min, max);
-}
-
-
-inline int
-a2sll_c(long long *restrict n, const char *s,
-    const char **restrict endp, int base, long long min, long long max)
-{
-       return a2sll(n, (char *) s, (char **) endp, base, min, max);
-}
-
-
-inline int
-a2uh_c(unsigned short *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned short min,
-    unsigned short max)
-{
-       return a2uh(n, (char *) s, (char **) endp, base, min, max);
-}
-
-
-inline int
-a2ui_c(unsigned int *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned int min, unsigned int max)
-{
-       return a2ui(n, (char *) s, (char **) endp, base, min, max);
-}
-
-
-inline int
-a2ul_c(unsigned long *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned long min, unsigned long max)
-{
-       return a2ul(n, (char *) s, (char **) endp, base, min, max);
-}
-
-
-inline int
-a2ull_c(unsigned long long *restrict n, const char *s,
-    const char **restrict endp, int base, unsigned long long min,
-    unsigned long long max)
-{
-       return a2ull(n, (char *) s, (char **) endp, base, min, max);
-}
-
-
-inline int
-a2sh_nc(short *restrict n, char *s,
-    char **restrict endp, int base, short min, short max)
-{
-       int  status;
-
-       *n = strtoi_(s, endp, base, min, max, &status);
-       if (status != 0) {
-               errno = status;
-               return -1;
-       }
-       return 0;
-}
-
-
-inline int
-a2si_nc(int *restrict n, char *s,
-    char **restrict endp, int base, int min, int max)
-{
-       int  status;
-
-       *n = strtoi_(s, endp, base, min, max, &status);
-       if (status != 0) {
-               errno = status;
-               return -1;
-       }
-       return 0;
-}
-
-
-inline int
-a2sl_nc(long *restrict n, char *s,
-    char **restrict endp, int base, long min, long max)
-{
-       int  status;
-
-       *n = strtoi_(s, endp, base, min, max, &status);
-       if (status != 0) {
-               errno = status;
-               return -1;
-       }
-       return 0;
-}
-
-
-inline int
-a2sll_nc(long long *restrict n, char *s,
-    char **restrict endp, int base, long long min, long long max)
-{
-       int  status;
-
-       *n = strtoi_(s, endp, base, min, max, &status);
-       if (status != 0) {
-               errno = status;
-               return -1;
-       }
-       return 0;
-}
-
-
-inline int
-a2uh_nc(unsigned short *restrict n, char *s,
-    char **restrict endp, int base, unsigned short min,
-    unsigned short max)
-{
-       int  status;
-
-       *n = strtou_noneg(s, endp, base, min, max, &status);
-       if (status != 0) {
-               errno = status;
-               return -1;
-       }
-       return 0;
-}
-
-
-inline int
-a2ui_nc(unsigned int *restrict n, char *s,
-    char **restrict endp, int base, unsigned int min, unsigned int max)
-{
-       int  status;
-
-       *n = strtou_noneg(s, endp, base, min, max, &status);
-       if (status != 0) {
-               errno = status;
-               return -1;
-       }
-       return 0;
-}
-
-
-inline int
-a2ul_nc(unsigned long *restrict n, char *s,
-    char **restrict endp, int base, unsigned long min, unsigned long max)
-{
-       int  status;
-
-       *n = strtou_noneg(s, endp, base, min, max, &status);
-       if (status != 0) {
-               errno = status;
-               return -1;
-       }
-       return 0;
-}
-
-
-inline int
-a2ull_nc(unsigned long long *restrict n, char *s,
-    char **restrict endp, int base, unsigned long long min,
-    unsigned long long max)
-{
-       int  status;
-
-       *n = strtou_noneg(s, endp, base, min, max, &status);
-       if (status != 0) {
-               errno = status;
-               return -1;
-       }
-       return 0;
-}
-
-
-#endif  // include guard
diff --git a/lib/atoi/a2i/a2i.c b/lib/atoi/a2i/a2i.c
new file mode 100644 (file)
index 0000000..ec4c976
--- /dev/null
@@ -0,0 +1,7 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2i.h"
diff --git a/lib/atoi/a2i/a2i.h b/lib/atoi/a2i/a2i.h
new file mode 100644 (file)
index 0000000..b1a4724
--- /dev/null
@@ -0,0 +1,62 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2I_H_
+#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2I_H_
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2s_c.h"
+#include "atoi/a2i/a2s_nc.h"
+#include "atoi/a2i/a2u_c.h"
+#include "atoi/a2i/a2u_nc.h"
+
+
+/*
+ * See the manual of these macros in liba2i's documentation:
+ * <http://www.alejandro-colomar.es/share/dist/liba2i/git/HEAD/liba2i-HEAD.pdf>
+ */
+
+
+#define a2i(TYPE, n, s, ...)                                                  \
+(                                                                             \
+       _Generic((void (*)(TYPE, typeof(s))) 0,                               \
+               void (*)(short,              const char *):  a2sh_c,          \
+               void (*)(short,              const void *):  a2sh_c,          \
+               void (*)(short,              char *):        a2sh_nc,         \
+               void (*)(short,              void *):        a2sh_nc,         \
+               void (*)(int,                const char *):  a2si_c,          \
+               void (*)(int,                const void *):  a2si_c,          \
+               void (*)(int,                char *):        a2si_nc,         \
+               void (*)(int,                void *):        a2si_nc,         \
+               void (*)(long,               const char *):  a2sl_c,          \
+               void (*)(long,               const void *):  a2sl_c,          \
+               void (*)(long,               char *):        a2sl_nc,         \
+               void (*)(long,               void *):        a2sl_nc,         \
+               void (*)(long long,          const char *):  a2sll_c,         \
+               void (*)(long long,          const void *):  a2sll_c,         \
+               void (*)(long long,          char *):        a2sll_nc,        \
+               void (*)(long long,          void *):        a2sll_nc,        \
+               void (*)(unsigned short,     const char *):  a2uh_c,          \
+               void (*)(unsigned short,     const void *):  a2uh_c,          \
+               void (*)(unsigned short,     char *):        a2uh_nc,         \
+               void (*)(unsigned short,     void *):        a2uh_nc,         \
+               void (*)(unsigned int,       const char *):  a2ui_c,          \
+               void (*)(unsigned int,       const void *):  a2ui_c,          \
+               void (*)(unsigned int,       char *):        a2ui_nc,         \
+               void (*)(unsigned int,       void *):        a2ui_nc,         \
+               void (*)(unsigned long,      const char *):  a2ul_c,          \
+               void (*)(unsigned long,      const void *):  a2ul_c,          \
+               void (*)(unsigned long,      char *):        a2ul_nc,         \
+               void (*)(unsigned long,      void *):        a2ul_nc,         \
+               void (*)(unsigned long long, const char *):  a2ull_c,         \
+               void (*)(unsigned long long, const void *):  a2ull_c,         \
+               void (*)(unsigned long long, char *):        a2ull_nc,        \
+               void (*)(unsigned long long, void *):        a2ull_nc         \
+       )(n, s, __VA_ARGS__)                                                  \
+)
+
+
+#endif  // include guard
diff --git a/lib/atoi/a2i/a2s.c b/lib/atoi/a2i/a2s.c
new file mode 100644 (file)
index 0000000..a60c97b
--- /dev/null
@@ -0,0 +1,7 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2s.h"
diff --git a/lib/atoi/a2i/a2s.h b/lib/atoi/a2i/a2s.h
new file mode 100644 (file)
index 0000000..935e109
--- /dev/null
@@ -0,0 +1,56 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_H_
+#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_H_
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2s_c.h"
+#include "atoi/a2i/a2s_nc.h"
+
+
+#define a2sh(n, s, ...)                                                       \
+(                                                                             \
+       _Generic(s,                                                           \
+               const char *:  a2sh_c,                                        \
+               const void *:  a2sh_c,                                        \
+               char *:        a2sh_nc,                                       \
+               void *:        a2sh_nc                                        \
+       )(n, s, __VA_ARGS__)                                                  \
+)
+
+#define a2si(n, s, ...)                                                       \
+(                                                                             \
+       _Generic(s,                                                           \
+               const char *:  a2si_c,                                        \
+               const void *:  a2si_c,                                        \
+               char *:        a2si_nc,                                       \
+               void *:        a2si_nc                                        \
+       )(n, s, __VA_ARGS__)                                                  \
+)
+
+#define a2sl(n, s, ...)                                                       \
+(                                                                             \
+       _Generic(s,                                                           \
+               const char *:  a2sl_c,                                        \
+               const void *:  a2sl_c,                                        \
+               char *:        a2sl_nc,                                       \
+               void *:        a2sl_nc                                        \
+       )(n, s, __VA_ARGS__)                                                  \
+)
+
+#define a2sll(n, s, ...)                                                      \
+(                                                                             \
+       _Generic(s,                                                           \
+               const char *:  a2sll_c,                                       \
+               const void *:  a2sll_c,                                       \
+               char *:        a2sll_nc,                                      \
+               void *:        a2sll_nc                                       \
+       )(n, s, __VA_ARGS__)                                                  \
+)
+
+
+#endif  // include guard
diff --git a/lib/atoi/a2i/a2s_c.c b/lib/atoi/a2i/a2s_c.c
new file mode 100644 (file)
index 0000000..257b8d4
--- /dev/null
@@ -0,0 +1,17 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2s_c.h"
+
+
+extern inline int a2sh_c(short *restrict n, const char *s,
+    const char **restrict endp, int base, short min, short max);
+extern inline int a2si_c(int *restrict n, const char *s,
+    const char **restrict endp, int base, int min, int max);
+extern inline int a2sl_c(long *restrict n, const char *s,
+    const char **restrict endp, int base, long min, long max);
+extern inline int a2sll_c(long long *restrict n, const char *s,
+    const char **restrict endp, int base, long long min, long long max);
diff --git a/lib/atoi/a2i/a2s_c.h b/lib/atoi/a2i/a2s_c.h
new file mode 100644 (file)
index 0000000..5d0024d
--- /dev/null
@@ -0,0 +1,64 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_C_H_
+#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_C_H_
+
+
+#include <config.h>
+
+#include <errno.h>
+#include <inttypes.h>
+
+#include "atoi/a2i/a2s_nc.h"
+#include "attr.h"
+
+
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2sh_c(short *restrict n, const char *s,
+    const char **restrict endp, int base, short min, short max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2si_c(int *restrict n, const char *s,
+    const char **restrict endp, int base, int min, int max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2sl_c(long *restrict n, const char *s,
+    const char **restrict endp, int base, long min, long max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2sll_c(long long *restrict n, const char *s,
+    const char **restrict endp, int base, long long min, long long max);
+
+
+inline int
+a2sh_c(short *restrict n, const char *s,
+    const char **restrict endp, int base, short min, short max)
+{
+       return a2sh_nc(n, (char *) s, (char **) endp, base, min, max);
+}
+
+
+inline int
+a2si_c(int *restrict n, const char *s,
+    const char **restrict endp, int base, int min, int max)
+{
+       return a2si_nc(n, (char *) s, (char **) endp, base, min, max);
+}
+
+
+inline int
+a2sl_c(long *restrict n, const char *s,
+    const char **restrict endp, int base, long min, long max)
+{
+       return a2sl_nc(n, (char *) s, (char **) endp, base, min, max);
+}
+
+
+inline int
+a2sll_c(long long *restrict n, const char *s,
+    const char **restrict endp, int base, long long min, long long max)
+{
+       return a2sll_nc(n, (char *) s, (char **) endp, base, min, max);
+}
+
+
+#endif  // include guard
diff --git a/lib/atoi/a2i/a2s_nc.c b/lib/atoi/a2i/a2s_nc.c
new file mode 100644 (file)
index 0000000..7ef8be6
--- /dev/null
@@ -0,0 +1,17 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2s_nc.h"
+
+
+extern inline int a2sh_nc(short *restrict n, char *s,
+    char **restrict endp, int base, short min, short max);
+extern inline int a2si_nc(int *restrict n, char *s,
+    char **restrict endp, int base, int min, int max);
+extern inline int a2sl_nc(long *restrict n, char *s,
+    char **restrict endp, int base, long min, long max);
+extern inline int a2sll_nc(long long *restrict n, char *s,
+    char **restrict endp, int base, long long min, long long max);
diff --git a/lib/atoi/a2i/a2s_nc.h b/lib/atoi/a2i/a2s_nc.h
new file mode 100644 (file)
index 0000000..8ca16f2
--- /dev/null
@@ -0,0 +1,91 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_NC_H_
+#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2S_NC_H_
+
+
+#include <config.h>
+
+#include <errno.h>
+
+#include "atoi/strtoi/strtoi.h"
+#include "attr.h"
+
+
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2sh_nc(short *restrict n, char *s,
+    char **restrict endp, int base, short min, short max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2si_nc(int *restrict n, char *s,
+    char **restrict endp, int base, int min, int max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2sl_nc(long *restrict n, char *s,
+    char **restrict endp, int base, long min, long max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2sll_nc(long long *restrict n, char *s,
+    char **restrict endp, int base, long long min, long long max);
+
+
+inline int
+a2sh_nc(short *restrict n, char *s,
+    char **restrict endp, int base, short min, short max)
+{
+       int  status;
+
+       *n = strtoi_(s, endp, base, min, max, &status);
+       if (status != 0) {
+               errno = status;
+               return -1;
+       }
+       return 0;
+}
+
+
+inline int
+a2si_nc(int *restrict n, char *s,
+    char **restrict endp, int base, int min, int max)
+{
+       int  status;
+
+       *n = strtoi_(s, endp, base, min, max, &status);
+       if (status != 0) {
+               errno = status;
+               return -1;
+       }
+       return 0;
+}
+
+
+inline int
+a2sl_nc(long *restrict n, char *s,
+    char **restrict endp, int base, long min, long max)
+{
+       int  status;
+
+       *n = strtoi_(s, endp, base, min, max, &status);
+       if (status != 0) {
+               errno = status;
+               return -1;
+       }
+       return 0;
+}
+
+
+inline int
+a2sll_nc(long long *restrict n, char *s,
+    char **restrict endp, int base, long long min, long long max)
+{
+       int  status;
+
+       *n = strtoi_(s, endp, base, min, max, &status);
+       if (status != 0) {
+               errno = status;
+               return -1;
+       }
+       return 0;
+}
+
+
+#endif  // include guard
diff --git a/lib/atoi/a2i/a2u.c b/lib/atoi/a2i/a2u.c
new file mode 100644 (file)
index 0000000..8523e8b
--- /dev/null
@@ -0,0 +1,7 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2u.h"
diff --git a/lib/atoi/a2i/a2u.h b/lib/atoi/a2i/a2u.h
new file mode 100644 (file)
index 0000000..2a3852e
--- /dev/null
@@ -0,0 +1,56 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_H_
+#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_H_
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2u_c.h"
+#include "atoi/a2i/a2u_nc.h"
+
+
+#define a2uh(n, s, ...)                                                       \
+(                                                                             \
+       _Generic(s,                                                           \
+               const char *:  a2uh_c,                                        \
+               const void *:  a2uh_c,                                        \
+               char *:        a2uh_nc,                                       \
+               void *:        a2uh_nc                                        \
+       )(n, s, __VA_ARGS__)                                                  \
+)
+
+#define a2ui(n, s, ...)                                                       \
+(                                                                             \
+       _Generic(s,                                                           \
+               const char *:  a2ui_c,                                        \
+               const void *:  a2ui_c,                                        \
+               char *:        a2ui_nc,                                       \
+               void *:        a2ui_nc                                        \
+       )(n, s, __VA_ARGS__)                                                  \
+)
+
+#define a2ul(n, s, ...)                                                       \
+(                                                                             \
+       _Generic(s,                                                           \
+               const char *:  a2ul_c,                                        \
+               const void *:  a2ul_c,                                        \
+               char *:        a2ul_nc,                                       \
+               void *:        a2ul_nc                                        \
+       )(n, s, __VA_ARGS__)                                                  \
+)
+
+#define a2ull(n, s, ...)                                                      \
+(                                                                             \
+       _Generic(s,                                                           \
+               const char *:  a2ull_c,                                       \
+               const void *:  a2ull_c,                                       \
+               char *:        a2ull_nc,                                      \
+               void *:        a2ull_nc                                       \
+       )(n, s, __VA_ARGS__)                                                  \
+)
+
+
+#endif  // include guard
diff --git a/lib/atoi/a2i/a2u_c.c b/lib/atoi/a2i/a2u_c.c
new file mode 100644 (file)
index 0000000..e1d04b8
--- /dev/null
@@ -0,0 +1,19 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2u_c.h"
+
+
+extern inline int a2uh_c(unsigned short *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned short min,
+    unsigned short max);
+extern inline int a2ui_c(unsigned int *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned int min, unsigned int max);
+extern inline int a2ul_c(unsigned long *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned long min, unsigned long max);
+extern inline int a2ull_c(unsigned long long *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned long long min,
+    unsigned long long max);
diff --git a/lib/atoi/a2i/a2u_c.h b/lib/atoi/a2i/a2u_c.h
new file mode 100644 (file)
index 0000000..420e785
--- /dev/null
@@ -0,0 +1,65 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_C_H_
+#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_C_H_
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2u_nc.h"
+#include "attr.h"
+
+
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2uh_c(unsigned short *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned short min,
+    unsigned short max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2ui_c(unsigned int *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned int min, unsigned int max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2ul_c(unsigned long *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned long min, unsigned long max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2ull_c(unsigned long long *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned long long min,
+    unsigned long long max);
+
+
+inline int
+a2uh_c(unsigned short *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned short min,
+    unsigned short max)
+{
+       return a2uh_nc(n, (char *) s, (char **) endp, base, min, max);
+}
+
+
+inline int
+a2ui_c(unsigned int *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned int min, unsigned int max)
+{
+       return a2ui_nc(n, (char *) s, (char **) endp, base, min, max);
+}
+
+
+inline int
+a2ul_c(unsigned long *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned long min, unsigned long max)
+{
+       return a2ul_nc(n, (char *) s, (char **) endp, base, min, max);
+}
+
+
+inline int
+a2ull_c(unsigned long long *restrict n, const char *s,
+    const char **restrict endp, int base, unsigned long long min,
+    unsigned long long max)
+{
+       return a2ull_nc(n, (char *) s, (char **) endp, base, min, max);
+}
+
+
+#endif  // include guard
diff --git a/lib/atoi/a2i/a2u_nc.c b/lib/atoi/a2i/a2u_nc.c
new file mode 100644 (file)
index 0000000..4ca282b
--- /dev/null
@@ -0,0 +1,18 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/a2i/a2u_nc.h"
+
+
+extern inline int a2uh_nc(unsigned short *restrict n, char *s,
+    char **restrict endp, int base, unsigned short min, unsigned short max);
+extern inline int a2ui_nc(unsigned int *restrict n, char *s,
+    char **restrict endp, int base, unsigned int min, unsigned int max);
+extern inline int a2ul_nc(unsigned long *restrict n, char *s,
+    char **restrict endp, int base, unsigned long min, unsigned long max);
+extern inline int a2ull_nc(unsigned long long *restrict n, char *s,
+    char **restrict endp, int base, unsigned long long min,
+    unsigned long long max);
diff --git a/lib/atoi/a2i/a2u_nc.h b/lib/atoi/a2i/a2u_nc.h
new file mode 100644 (file)
index 0000000..c8d993e
--- /dev/null
@@ -0,0 +1,94 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_NC_H_
+#define SHADOW_INCLUDE_LIB_ATOI_A2I_A2U_NC_H_
+
+
+#include <config.h>
+
+#include <errno.h>
+
+#include "atoi/strtoi/strtou_noneg.h"
+#include "attr.h"
+
+
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2uh_nc(unsigned short *restrict n, char *s,
+    char **restrict endp, int base, unsigned short min, unsigned short max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2ui_nc(unsigned int *restrict n, char *s,
+    char **restrict endp, int base, unsigned int min, unsigned int max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2ul_nc(unsigned long *restrict n, char *s,
+    char **restrict endp, int base, unsigned long min, unsigned long max);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1) ATTR_ACCESS(write_only, 3)
+inline int a2ull_nc(unsigned long long *restrict n, char *s,
+    char **restrict endp, int base, unsigned long long min,
+    unsigned long long max);
+
+
+inline int
+a2uh_nc(unsigned short *restrict n, char *s,
+    char **restrict endp, int base, unsigned short min,
+    unsigned short max)
+{
+       int  status;
+
+       *n = strtou_noneg(s, endp, base, min, max, &status);
+       if (status != 0) {
+               errno = status;
+               return -1;
+       }
+       return 0;
+}
+
+
+inline int
+a2ui_nc(unsigned int *restrict n, char *s,
+    char **restrict endp, int base, unsigned int min, unsigned int max)
+{
+       int  status;
+
+       *n = strtou_noneg(s, endp, base, min, max, &status);
+       if (status != 0) {
+               errno = status;
+               return -1;
+       }
+       return 0;
+}
+
+
+inline int
+a2ul_nc(unsigned long *restrict n, char *s,
+    char **restrict endp, int base, unsigned long min, unsigned long max)
+{
+       int  status;
+
+       *n = strtou_noneg(s, endp, base, min, max, &status);
+       if (status != 0) {
+               errno = status;
+               return -1;
+       }
+       return 0;
+}
+
+
+inline int
+a2ull_nc(unsigned long long *restrict n, char *s,
+    char **restrict endp, int base, unsigned long long min,
+    unsigned long long max)
+{
+       int  status;
+
+       *n = strtou_noneg(s, endp, base, min, max, &status);
+       if (status != 0) {
+               errno = status;
+               return -1;
+       }
+       return 0;
+}
+
+
+#endif  // include guard
index efb8bcb46a6eb97b0b4379c9a71f8e84baa0a846..33d4876a4d90886964690e6c2e0aae8a0de76dbb 100644 (file)
@@ -13,7 +13,8 @@
 #include <stddef.h>
 #include <sys/types.h>
 
-#include "atoi/a2i.h"
+#include "atoi/a2i/a2i.h"
+#include "atoi/a2i/a2s.h"
 #include "attr.h"
 #include "typetraits.h"
 
diff --git a/lib/atoi/str2i.h b/lib/atoi/str2i.h
deleted file mode 100644 (file)
index b3ded03..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-// SPDX-FileCopyrightText: 2007-2009, Nicolas François
-// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
-// SPDX-License-Identifier: BSD-3-Clause
-
-
-#ifndef SHADOW_INCLUDE_LIB_ATOI_STR2I_H_
-#define SHADOW_INCLUDE_LIB_ATOI_STR2I_H_
-
-
-#include <config.h>
-
-#include <limits.h>
-#include <stddef.h>
-
-#include "atoi/a2i.h"
-#include "attr.h"
-
-
-#define str2i(TYPE, ...)                                                      \
-(                                                                             \
-       _Generic((TYPE) 0,                                                    \
-               short:              str2sh,                                   \
-               int:                str2si,                                   \
-               long:               str2sl,                                   \
-               long long:          str2sll,                                  \
-               unsigned short:     str2uh,                                   \
-               unsigned int:       str2ui,                                   \
-               unsigned long:      str2ul,                                   \
-               unsigned long long: str2ull                                   \
-       )(__VA_ARGS__)                                                        \
-)
-
-
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
-inline int str2sh(short *restrict n, const char *restrict s);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
-inline int str2si(int *restrict n, const char *restrict s);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
-inline int str2sl(long *restrict n, const char *restrict s);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
-inline int str2sll(long long *restrict n, const char *restrict s);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
-inline int str2uh(unsigned short *restrict n, const char *restrict s);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
-inline int str2ui(unsigned int *restrict n, const char *restrict s);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
-inline int str2ul(unsigned long *restrict n, const char *restrict s);
-ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
-inline int str2ull(unsigned long long *restrict n, const char *restrict s);
-
-
-inline int
-str2sh(short *restrict n, const char *restrict s)
-{
-       return a2sh(n, s, NULL, 0, SHRT_MIN, SHRT_MAX);
-}
-
-
-inline int
-str2si(int *restrict n, const char *restrict s)
-{
-       return a2si(n, s, NULL, 0, INT_MIN, INT_MAX);
-}
-
-
-inline int
-str2sl(long *restrict n, const char *restrict s)
-{
-       return a2sl(n, s, NULL, 0, LONG_MIN, LONG_MAX);
-}
-
-
-inline int
-str2sll(long long *restrict n, const char *restrict s)
-{
-       return a2sll(n, s, NULL, 0, LLONG_MIN, LLONG_MAX);
-}
-
-
-inline int
-str2uh(unsigned short *restrict n, const char *restrict s)
-{
-       return a2uh(n, s, NULL, 0, 0, USHRT_MAX);
-}
-
-
-inline int
-str2ui(unsigned int *restrict n, const char *restrict s)
-{
-       return a2ui(n, s, NULL, 0, 0, UINT_MAX);
-}
-
-
-inline int
-str2ul(unsigned long *restrict n, const char *restrict s)
-{
-       return a2ul(n, s, NULL, 0, 0, ULONG_MAX);
-}
-
-
-inline int
-str2ull(unsigned long long *restrict n, const char *restrict s)
-{
-       return a2ull(n, s, NULL, 0, 0, ULLONG_MAX);
-}
-
-
-#endif  // include guard
diff --git a/lib/atoi/str2i/str2i.c b/lib/atoi/str2i/str2i.c
new file mode 100644 (file)
index 0000000..ff5ad8f
--- /dev/null
@@ -0,0 +1,8 @@
+// SPDX-FileCopyrightText: 2007-2009, Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/str2i/str2i.h"
diff --git a/lib/atoi/str2i/str2i.h b/lib/atoi/str2i/str2i.h
new file mode 100644 (file)
index 0000000..e2cecc7
--- /dev/null
@@ -0,0 +1,31 @@
+// SPDX-FileCopyrightText: 2007-2009, Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2I_H_
+#define SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2I_H_
+
+
+#include <config.h>
+
+#include "atoi/str2i/str2s.h"
+#include "atoi/str2i/str2u.h"
+
+
+#define str2i(TYPE, ...)                                                      \
+(                                                                             \
+       _Generic((TYPE) 0,                                                    \
+               short:              str2sh,                                   \
+               int:                str2si,                                   \
+               long:               str2sl,                                   \
+               long long:          str2sll,                                  \
+               unsigned short:     str2uh,                                   \
+               unsigned int:       str2ui,                                   \
+               unsigned long:      str2ul,                                   \
+               unsigned long long: str2ull                                   \
+       )(__VA_ARGS__)                                                        \
+)
+
+
+#endif  // include guard
diff --git a/lib/atoi/str2i/str2s.c b/lib/atoi/str2i/str2s.c
new file mode 100644 (file)
index 0000000..f77c594
--- /dev/null
@@ -0,0 +1,14 @@
+// SPDX-FileCopyrightText: 2007-2009, Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/str2i/str2s.h"
+
+
+extern inline int str2sh(short *restrict n, const char *restrict s);
+extern inline int str2si(int *restrict n, const char *restrict s);
+extern inline int str2sl(long *restrict n, const char *restrict s);
+extern inline int str2sll(long long *restrict n, const char *restrict s);
diff --git a/lib/atoi/str2i/str2s.h b/lib/atoi/str2i/str2s.h
new file mode 100644 (file)
index 0000000..dc20faa
--- /dev/null
@@ -0,0 +1,57 @@
+// SPDX-FileCopyrightText: 2007-2009, Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2S_H_
+#define SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2S_H_
+
+
+#include <config.h>
+
+#include <limits.h>
+#include <stddef.h>
+
+#include "atoi/a2i/a2s.h"
+#include "attr.h"
+
+
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2sh(short *restrict n, const char *restrict s);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2si(int *restrict n, const char *restrict s);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2sl(long *restrict n, const char *restrict s);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2sll(long long *restrict n, const char *restrict s);
+
+
+inline int
+str2sh(short *restrict n, const char *restrict s)
+{
+       return a2sh(n, s, NULL, 0, SHRT_MIN, SHRT_MAX);
+}
+
+
+inline int
+str2si(int *restrict n, const char *restrict s)
+{
+       return a2si(n, s, NULL, 0, INT_MIN, INT_MAX);
+}
+
+
+inline int
+str2sl(long *restrict n, const char *restrict s)
+{
+       return a2sl(n, s, NULL, 0, LONG_MIN, LONG_MAX);
+}
+
+
+inline int
+str2sll(long long *restrict n, const char *restrict s)
+{
+       return a2sll(n, s, NULL, 0, LLONG_MIN, LLONG_MAX);
+}
+
+
+#endif  // include guard
similarity index 62%
rename from lib/atoi/str2i.c
rename to lib/atoi/str2i/str2u.c
index 25ce3609b052cd0773b4e0d3bffd821a2ed64427..25fffda9c7e9c8cc158413a3be11dc051bfc6d1c 100644 (file)
@@ -5,13 +5,9 @@
 
 #include <config.h>
 
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2u.h"
 
 
-extern inline int str2sh(short *restrict n, const char *restrict s);
-extern inline int str2si(int *restrict n, const char *restrict s);
-extern inline int str2sl(long *restrict n, const char *restrict s);
-extern inline int str2sll(long long *restrict n, const char *restrict s);
 extern inline int str2uh(unsigned short *restrict n, const char *restrict s);
 extern inline int str2ui(unsigned int *restrict n, const char *restrict s);
 extern inline int str2ul(unsigned long *restrict n, const char *restrict s);
diff --git a/lib/atoi/str2i/str2u.h b/lib/atoi/str2i/str2u.h
new file mode 100644 (file)
index 0000000..c25941c
--- /dev/null
@@ -0,0 +1,57 @@
+// SPDX-FileCopyrightText: 2007-2009, Nicolas François
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2U_H_
+#define SHADOW_INCLUDE_LIB_ATOI_STR2I_STR2U_H_
+
+
+#include <config.h>
+
+#include <limits.h>
+#include <stddef.h>
+
+#include "atoi/a2i/a2u.h"
+#include "attr.h"
+
+
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2uh(unsigned short *restrict n, const char *restrict s);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2ui(unsigned int *restrict n, const char *restrict s);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2ul(unsigned long *restrict n, const char *restrict s);
+ATTR_STRING(2) ATTR_ACCESS(write_only, 1)
+inline int str2ull(unsigned long long *restrict n, const char *restrict s);
+
+
+inline int
+str2uh(unsigned short *restrict n, const char *restrict s)
+{
+       return a2uh(n, s, NULL, 0, 0, USHRT_MAX);
+}
+
+
+inline int
+str2ui(unsigned int *restrict n, const char *restrict s)
+{
+       return a2ui(n, s, NULL, 0, 0, UINT_MAX);
+}
+
+
+inline int
+str2ul(unsigned long *restrict n, const char *restrict s)
+{
+       return a2ul(n, s, NULL, 0, 0, ULONG_MAX);
+}
+
+
+inline int
+str2ull(unsigned long long *restrict n, const char *restrict s)
+{
+       return a2ull(n, s, NULL, 0, 0, ULLONG_MAX);
+}
+
+
+#endif  // include guard
diff --git a/lib/atoi/strtoi.c b/lib/atoi/strtoi.c
deleted file mode 100644 (file)
index 197707b..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
-// SPDX-License-Identifier: BSD-3-Clause
-
-
-#include <config.h>
-
-#include "atoi/strtoi.h"
-
-#include <stdint.h>
-
-
-extern inline intmax_t strtoi_(const char *s, char **restrict endp, int base,
-    intmax_t min, intmax_t max, int *restrict status);
-extern inline uintmax_t strtou_(const char *s, char **restrict endp, int base,
-    uintmax_t min, uintmax_t max, int *restrict status);
diff --git a/lib/atoi/strtoi.h b/lib/atoi/strtoi.h
deleted file mode 100644 (file)
index 1f061fc..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
-// SPDX-License-Identifier: BSD-3-Clause
-
-
-#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOI_H_
-#define SHADOW_INCLUDE_LIB_ATOI_STRTOI_H_
-
-
-#include <config.h>
-
-#include <errno.h>
-#include <inttypes.h>
-#include <stddef.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include <sys/param.h>
-
-#include "attr.h"
-
-
-#define strtoNmax(TYPE, ...)                                                  \
-(                                                                             \
-       _Generic((TYPE) 0,                                                    \
-               intmax_t:  strtoimax,                                         \
-               uintmax_t: strtoumax                                          \
-       )(__VA_ARGS__)                                                        \
-)
-
-
-#define strtoN(s, endp, base, min, max, status, TYPE)                         \
-({                                                                            \
-       const char  *s_ = s;                                                  \
-       char        **endp_ = endp;                                           \
-       int         base_ = base;                                             \
-       TYPE        min_ = min;                                               \
-       TYPE        max_ = max;                                               \
-       int         *status_ = status;                                        \
-                                                                              \
-       int         e_, st_;                                                  \
-       char        *end_;                                                    \
-       TYPE        n_;                                                       \
-                                                                              \
-       if (endp_ == NULL)                                                    \
-               endp_ = &end_;                                                \
-       if (status_ == NULL)                                                  \
-               status_ = &st_;                                               \
-                                                                              \
-       if (base_ != 0 && (base_ < 0 || base_ > 36)) {                        \
-               *status_ = EINVAL;                                            \
-               n_ = 0;                                                       \
-                                                                              \
-       } else {                                                              \
-               e_ = errno;                                                   \
-               errno = 0;                                                    \
-               n_ = strtoNmax(TYPE, s_, endp_, base_);                       \
-                                                                              \
-               if (*endp_ == s_)                                             \
-                       *status_ = ECANCELED;                                 \
-               else if (errno == ERANGE || n_ < min_ || n_ > max_)           \
-                       *status_ = ERANGE;                                    \
-               else if (**endp_ != '\0')                                     \
-                       *status_ = ENOTSUP;                                   \
-               else                                                          \
-                       *status_ = 0;                                         \
-                                                                              \
-               errno = e_;                                                   \
-       }                                                                     \
-       MAX(min_, MIN(max_, n_));                                             \
-})
-
-
-ATTR_STRING(1) ATTR_ACCESS(write_only, 2) ATTR_ACCESS(write_only, 6)
-inline intmax_t strtoi_(const char *s, char **restrict endp, int base,
-    intmax_t min, intmax_t max, int *restrict status);
-ATTR_STRING(1) ATTR_ACCESS(write_only, 2) ATTR_ACCESS(write_only, 6)
-inline uintmax_t strtou_(const char *s, char **restrict endp, int base,
-    uintmax_t min, uintmax_t max, int *restrict status);
-
-
-inline intmax_t
-strtoi_(const char *s, char **restrict endp, int base,
-    intmax_t min, intmax_t max, int *restrict status)
-{
-       return strtoN(s, endp, base, min, max, status, intmax_t);
-}
-
-
-inline uintmax_t
-strtou_(const char *s, char **restrict endp, int base,
-    uintmax_t min, uintmax_t max, int *restrict status)
-{
-       return strtoN(s, endp, base, min, max, status, uintmax_t);
-}
-
-
-#endif  // include guard
diff --git a/lib/atoi/strtoi/strtoi.c b/lib/atoi/strtoi/strtoi.c
new file mode 100644 (file)
index 0000000..c478c2a
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/strtoi/strtoi.h"
+
+#include <stdint.h>
+
+
+extern inline intmax_t strtoi_(const char *s, char **restrict endp, int base,
+    intmax_t min, intmax_t max, int *restrict status);
diff --git a/lib/atoi/strtoi/strtoi.h b/lib/atoi/strtoi/strtoi.h
new file mode 100644 (file)
index 0000000..a8f6f54
--- /dev/null
@@ -0,0 +1,64 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOI_H_
+#define SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOI_H_
+
+
+#include <config.h>
+
+#include <errno.h>
+#include <inttypes.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/param.h>
+
+#include "attr.h"
+
+
+ATTR_STRING(1) ATTR_ACCESS(write_only, 2) ATTR_ACCESS(write_only, 6)
+inline intmax_t strtoi_(const char *s, char **restrict endp, int base,
+    intmax_t min, intmax_t max, int *restrict status);
+
+
+inline intmax_t
+strtoi_(const char *s, char **restrict endp, int base,
+    intmax_t min, intmax_t max, int *restrict status)
+{
+       int        e, st;
+       char       *end;
+       intmax_t   n;
+
+       if (endp == NULL)
+               endp = &end;
+       if (status == NULL)
+               status = &st;
+
+       if (base != 0 && (base < 0 || base > 36)) {
+               *status = EINVAL;
+               return MAX(min, MIN(max, 0));
+       }
+
+       e = errno;
+       errno = 0;
+
+       n = strtoimax(s, endp, base);
+
+       if (*endp == s)
+               *status = ECANCELED;
+       else if (errno == ERANGE || n < min || n > max)
+               *status = ERANGE;
+       else if (**endp != '\0')
+               *status = ENOTSUP;
+       else
+               *status = 0;
+
+       errno = e;
+
+       return MAX(min, MIN(max, n));
+}
+
+
+#endif  // include guard
diff --git a/lib/atoi/strtoi/strtou.c b/lib/atoi/strtoi/strtou.c
new file mode 100644 (file)
index 0000000..c70ca4e
--- /dev/null
@@ -0,0 +1,13 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#include <config.h>
+
+#include "atoi/strtoi/strtou.h"
+
+#include <stdint.h>
+
+
+extern inline uintmax_t strtou_(const char *s, char **restrict endp, int base,
+    uintmax_t min, uintmax_t max, int *restrict status);
diff --git a/lib/atoi/strtoi/strtou.h b/lib/atoi/strtoi/strtou.h
new file mode 100644 (file)
index 0000000..5ce7bd6
--- /dev/null
@@ -0,0 +1,64 @@
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
+// SPDX-License-Identifier: BSD-3-Clause
+
+
+#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_H_
+#define SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_H_
+
+
+#include <config.h>
+
+#include <errno.h>
+#include <inttypes.h>
+#include <stddef.h>
+#include <stdint.h>
+#include <stdlib.h>
+#include <sys/param.h>
+
+#include "attr.h"
+
+
+ATTR_STRING(1) ATTR_ACCESS(write_only, 2) ATTR_ACCESS(write_only, 6)
+inline uintmax_t strtou_(const char *s, char **restrict endp, int base,
+    uintmax_t min, uintmax_t max, int *restrict status);
+
+
+inline uintmax_t
+strtou_(const char *s, char **restrict endp, int base,
+    uintmax_t min, uintmax_t max, int *restrict status)
+{
+       int        e, st;
+       char       *end;
+       uintmax_t  n;
+
+       if (endp == NULL)
+               endp = &end;
+       if (status == NULL)
+               status = &st;
+
+       if (base != 0 && (base < 0 || base > 36)) {
+               *status = EINVAL;
+               return MAX(min, 0);
+       }
+
+       e = errno;
+       errno = 0;
+
+       n = strtoumax(s, endp, base);
+
+       if (*endp == s)
+               *status = ECANCELED;
+       else if (errno == ERANGE || n < min || n > max)
+               *status = ERANGE;
+       else if (**endp != '\0')
+               *status = ENOTSUP;
+       else
+               *status = 0;
+
+       errno = e;
+
+       return MAX(min, MIN(max, n));
+}
+
+
+#endif  // include guard
similarity index 67%
rename from lib/atoi/strtou_noneg.c
rename to lib/atoi/strtoi/strtou_noneg.c
index 71cacbd1e85fe3fe258f46430f0529829c63e6d1..51d60c93068a4fe5aface5327f2ca4defb6fde74 100644 (file)
@@ -1,10 +1,10 @@
-// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
 // SPDX-License-Identifier: BSD-3-Clause
 
 
 #include <config.h>
 
-#include "atoi/strtou_noneg.h"
+#include "atoi/strtoi/strtou_noneg.h"
 
 #include <stdint.h>
 
similarity index 73%
rename from lib/atoi/strtou_noneg.h
rename to lib/atoi/strtoi/strtou_noneg.h
index 6d77adf5ecd76ffb4d311f3f4c990e0b526b8209..52fa9034a3bb6cd99a6e1948d7b4976666eaccc3 100644 (file)
@@ -1,9 +1,9 @@
-// SPDX-FileCopyrightText: 2023, Alejandro Colomar <alx@kernel.org>
+// SPDX-FileCopyrightText: 2023-2024, Alejandro Colomar <alx@kernel.org>
 // SPDX-License-Identifier: BSD-3-Clause
 
 
-#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOU_NONEG_H_
-#define SHADOW_INCLUDE_LIB_ATOI_STRTOU_NONEG_H_
+#ifndef SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_NONEG_H_
+#define SHADOW_INCLUDE_LIB_ATOI_STRTOI_STRTOU_NONEG_H_
 
 
 #include <config.h>
@@ -12,7 +12,8 @@
 #include <stddef.h>
 #include <stdint.h>
 
-#include "atoi/strtoi.h"
+#include "atoi/strtoi/strtoi.h"
+#include "atoi/strtoi/strtou.h"
 #include "attr.h"
 
 
index ce1f98dd75ae58affa92325eb059213d90b16106..335c723e101558a1a8876347d4d9e44df5c0d5a1 100644 (file)
@@ -22,8 +22,9 @@
 #include <libeconf.h>
 #endif
 
-#include "atoi/a2i.h"
-#include "atoi/str2i.h"
+#include "atoi/a2i/a2s.h"
+#include "atoi/a2i/a2u.h"
+#include "atoi/str2i/str2u.h"
 #include "defines.h"
 #include "getdef.h"
 #include "prototypes.h"
index 466e9089225e116f77c044360353a7ea64958be4..603152e68a660804a3668a0b10b447b79611eef3 100644 (file)
@@ -10,7 +10,7 @@
 #include <ctype.h>
 #include <stdlib.h>
 
-#include "atoi/a2i.h"
+#include "atoi/a2i/a2u.h"
 #include "defines.h"
 #include "prototypes.h"
 
index c61c88c395d47b3c04d60db8eccbd173f4bf4803..69285e543ca9c79220268a727726db11f48cf134 100644 (file)
@@ -11,7 +11,7 @@
 #include <limits.h>
 #include <stdio.h>
 
-#include "atoi/a2i.h"
+#include "atoi/a2i/a2i.h"
 #include "defines.h"
 #include "prototypes.h"
 #include "shadowlog.h"
index adc61af88cdd3d2f14b071f1455cb4816f936ab3..248269c84006a2fe81cd736ef91f54b4de14841d 100644 (file)
@@ -15,7 +15,7 @@
 
 #include "alloc/calloc.h"
 #include "alloc/x/xmalloc.h"
-#include "atoi/a2i.h"
+#include "atoi/a2i/a2u.h"
 #include "prototypes.h"
 #include "string/sprintf/stpeprintf.h"
 #include "idmapping.h"
index fe0e24db716226a2d591c8c2239f4a608777b12a..9713a305bf06a6c531b4994bb2598de4a764c3b5 100644 (file)
 #include "shadowlog.h"
 #include <sys/resource.h>
 
-#include "atoi/a2i.h"
-#include "atoi/str2i.h"
+#include "atoi/a2i/a2i.h"
+#include "atoi/a2i/a2s.h"
+#include "atoi/str2i/str2i.h"
+#include "atoi/str2i/str2s.h"
+#include "atoi/str2i/str2u.h"
 #include "memzero.h"
 #include "typetraits.h"
 
index 3ebe427c8261f6f0ec3264c0e917490865dbd20a..97f64edd5ee80f9688e52b83fa1a9af2edd52489 100644 (file)
@@ -19,8 +19,8 @@
 #include <sys/types.h>
 #include <string.h>
 
-#include "atoi/a2i.h"
-#include "atoi/str2i.h"
+#include "atoi/a2i/a2s.h"
+#include "atoi/str2i/str2u.h"
 #include "defines.h"
 #include "prototypes.h"
 #include "shadowlog_internal.h"
index e243ac5a58a76be2ab5f2994641343d43069451c..8c08a834995ce12ccd041358b436a622d8635ed1 100644 (file)
@@ -18,8 +18,8 @@
 #include <string.h>
 #include <sys/types.h>
 
-#include "atoi/a2i.h"
-#include "atoi/str2i.h"
+#include "atoi/a2i/a2s.h"
+#include "atoi/str2i/str2u.h"
 #include "defines.h"
 #include "prototypes.h"
 #include "string/strtok/stpsep.h"
index dabd5b5299c2df857832c43bf6eb115846f8e7a7..2d69e74b1d8ca05f7af68dc7bf0876dbf0c724f6 100644 (file)
@@ -13,7 +13,7 @@
 
 #ident "$Id$"
 
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2s.h"
 #include "prototypes.h"
 #include "getdate.h"
 
index c417e71976be915c0fc6d3e5aa8bb6d35a911c8c..295df2bd4823c4877d15a0d4805a5d5761676daa 100644 (file)
@@ -21,7 +21,7 @@
 #include "alloc/malloc.h"
 #include "alloc/realloc.h"
 #include "alloc/reallocf.h"
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2u.h"
 #include "string/sprintf/snprintf.h"
 
 
index 4b482be7af6b40d78862272c80b9795944b78ac6..1e296fca500358fd11c112f1950930396878b7d0 100644 (file)
@@ -26,7 +26,7 @@
 #endif                         /* ACCT_TOOLS_SETUID */
 #include <pwd.h>
 
-#include "atoi/a2i.h"
+#include "atoi/a2i/a2s.h"
 #include "defines.h"
 #include "memzero.h"
 #include "prototypes.h"
index 35ecf12a8a13d692f1af4e69cee4bf367997e4f6..5f5b75918e6f1459d961f53a37edfd644fdc881a 100644 (file)
@@ -14,7 +14,7 @@
 #include <fcntl.h>
 
 #include "atoi/getnum.h"
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2u.h"
 #include "defines.h"
 #include "prototypes.h"
 #include "subordinateio.h"
index 4f87b824fc7a6f5b9a764104b7099f975c149942..50a299aed883c9f16b878eb413d3818492b1253b 100644 (file)
@@ -22,7 +22,7 @@
 #include "pam_defs.h"
 #endif                         /* USE_PAM */
 #endif                         /* ACCT_TOOLS_SETUID */
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2s.h"
 #include "defines.h"
 #include "nscd.h"
 #include "sssd.h"
index 9e12c6eec1b72149558ba6c94b161a8fae81338c..55817ddf4d6b2b364f5203710e1bef0f1cb2b561 100644 (file)
@@ -20,7 +20,7 @@
 #ifdef USE_PAM
 #include "pam_defs.h"
 #endif                         /* USE_PAM */
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2s.h"
 #include "defines.h"
 #include "nscd.h"
 #include "sssd.h"
index 23a9c6c532cdf9520b22c54d2546e7f83fdff344..cf02924998b98e69eb526beb6bddbcd7652adf31 100644 (file)
@@ -19,7 +19,7 @@
 #include <time.h>
 #include <assert.h>
 
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2s.h"
 #include "defines.h"
 #include "faillog.h"
 #include "memzero.h"
index 4bdacfb7dc76673617ab9478f00505f59f6bf303..bff6f7b2b7fe383fe5a58919c6fb59b73823da78 100644 (file)
@@ -4,7 +4,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2u.h"
 #include "subid.h"
 #include "stdlib.h"
 #include "prototypes.h"
index 3914b72bbefa91ec457419d91e0e30bffe50d43d..085e70cd03ca7eb550a6175d87b9c75681c6c62e 100644 (file)
@@ -23,7 +23,7 @@
 #include <net/if.h>
 #endif
 
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2u.h"
 #include "defines.h"
 #include "prototypes.h"
 #include "getdef.h"
index 6be957409c9d1857674bd26bfbba1a85e2ab8ab5..6c62cc08be8edcb01369844c2bd46329a6b15bde 100644 (file)
@@ -3,7 +3,7 @@
 #include <stdio.h>
 #include <unistd.h>
 
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2u.h"
 #include "subid.h"
 #include "stdlib.h"
 #include "prototypes.h"
index 74c8925afefe03e76cdc39fe95cd6bf66d877dce..bd24f7c72023f9a16008ef73e9276a007d719f81 100644 (file)
@@ -32,7 +32,7 @@
 
 #include "alloc/reallocf.h"
 #include "atoi/getnum.h"
-#include "atoi/str2i.h"
+#include "atoi/str2i/str2s.h"
 #ifdef ACCT_TOOLS_SETUID
 #ifdef USE_PAM
 #include "pam_defs.h"
index b7bf925db479d4ef86dc143694e1aa469c486d9b..7ec70fe12236eac8ee35c2916c60cc4a3718620f 100644 (file)
@@ -21,7 +21,7 @@
 #include <time.h>
 
 #include "agetpass.h"
-#include "atoi/a2i.h"
+#include "atoi/a2i/a2s.h"
 #include "defines.h"
 #include "getdef.h"
 #include "memzero.h"
index 82bf22395cb1054ee300a531822765c7d9c204a5..2134ce9e10267bf7ac6f1e68039249934226115e 100644 (file)
@@ -37,7 +37,7 @@
 #include <unistd.h>
 
 #include "alloc/x/xmalloc.h"
-#include "atoi/a2i.h"
+#include "atoi/a2i/a2s.h"
 #include "atoi/getnum.h"
 #include "chkname.h"
 #include "defines.h"
index 702675a9eb799e0df67440614c4822be29ece996..7181d47f85bec03edb8dbbf626449c69aea7aabe 100644 (file)
@@ -34,7 +34,8 @@
 
 #include "alloc/malloc.h"
 #include "alloc/x/xmalloc.h"
-#include "atoi/a2i.h"
+#include "atoi/a2i/a2i.h"
+#include "atoi/a2i/a2s.h"
 #include "atoi/getnum.h"
 #include "chkname.h"
 #include "defines.h"
index c854a15d076fb0e83b21ff19b3e06287d3ed5841..6a83973d7133b036362fea9d9feda94caf7b1120 100644 (file)
@@ -35,7 +35,8 @@ test_adds_LDADD = \
     $(NULL)
 
 test_atoi_strtoi_SOURCES = \
-    ../../lib/atoi/strtoi.c \
+    ../../lib/atoi/strtoi/strtoi.c \
+    ../../lib/atoi/strtoi/strtou_noneg.c \
     test_atoi_strtoi.c \
     $(NULL)
 test_atoi_strtoi_CFLAGS = \
index 535b6ab74578cd5fe153a9b33dafa8d510355963..02d62cf3d2ac22ff89be5f828b131dfcf7cc039a 100644 (file)
@@ -14,8 +14,8 @@
 #include <stdint.h>  // Required by <cmocka.h>
 #include <cmocka.h>
 
-#include "atoi/strtoi.h"
-#include "atoi/strtou_noneg.h"
+#include "atoi/strtoi/strtoi.h"
+#include "atoi/strtoi/strtou_noneg.h"
 
 
 static void test_strtoi(void **state);