]> git.ipfire.org Git - thirdparty/shadow.git/commitdiff
lib/atoi/strtou_noneg.[ch], tests/: strtoull_noneg(): Remove unused function
authorAlejandro Colomar <alx@kernel.org>
Tue, 9 Jan 2024 13:49:34 +0000 (14:49 +0100)
committerAlejandro Colomar <alx@kernel.org>
Mon, 27 May 2024 14:32:09 +0000 (16:32 +0200)
All call sites were replaced by a2i() recently.

Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
lib/atoi/strtou_noneg.c
lib/atoi/strtou_noneg.h
tests/unit/test_atoi_strtou_noneg.c

index ec8773d78ff4c4ef42b284e0eb730b0d16ca73b9..96a0b530e24726192751fbbf98eb43a79631fe1c 100644 (file)
@@ -14,5 +14,3 @@ extern inline uintmax_t strtou_noneg(const char *s, char **restrict endp,
 
 extern inline unsigned long strtoul_noneg(const char *s,
     char **restrict endp, int base);
-extern inline unsigned long long strtoull_noneg(const char *s,
-    char **restrict endp, int base);
index a1d1556967c79215f644c01810e18d0fbe7b79e5..c9411d0ea222211cb492862c5604b79c3d7b5f93 100644 (file)
@@ -23,9 +23,6 @@ inline uintmax_t strtou_noneg(const char *s, char **restrict endp,
 ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
 inline unsigned long strtoul_noneg(const char *s,
     char **restrict endp, int base);
-ATTR_STRING(1) ATTR_ACCESS(write_only, 2)
-inline unsigned long long strtoull_noneg(const char *s,
-    char **restrict endp, int base);
 
 
 inline uintmax_t
@@ -54,15 +51,4 @@ strtoul_noneg(const char *s, char **restrict endp, int base)
 }
 
 
-inline unsigned long long
-strtoull_noneg(const char *s, char **restrict endp, int base)
-{
-       if (strtol(s, endp, base) < 0) {
-               errno = ERANGE;
-               return 0;
-       }
-       return strtoull(s, endp, base);
-}
-
-
 #endif  // include guard
index 978bc0c49cbab0610f0621f599707d703b02c805..60631210db02236fa65747ede734dde1f3778f78 100644 (file)
@@ -17,7 +17,6 @@
 
 
 static void test_strtoul_noneg(void **state);
-static void test_strtoull_noneg(void **state);
 
 
 int
@@ -25,7 +24,6 @@ main(void)
 {
     const struct CMUnitTest  tests[] = {
         cmocka_unit_test(test_strtoul_noneg),
-        cmocka_unit_test(test_strtoull_noneg),
     };
 
     return cmocka_run_group_tests(tests, NULL, NULL);
@@ -52,25 +50,3 @@ test_strtoul_noneg(void **state)
        assert_true(strtoul_noneg("-0x10000000000000000", NULL, 0) == 0);
        assert_true(errno == ERANGE);
 }
-
-
-static void
-test_strtoull_noneg(void **state)
-{
-       errno = 0;
-       assert_true(strtoull_noneg("42", NULL, 0) == 42);
-       assert_true(errno == 0);
-
-       assert_true(strtoull_noneg("-1", NULL, 0) == 0);
-       assert_true(errno == ERANGE);
-       errno = 0;
-       assert_true(strtoull_noneg("-3", NULL, 0) == 0);
-       assert_true(errno == ERANGE);
-       errno = 0;
-       assert_true(strtoull_noneg("-0xFFFFFFFFFFFFFFFF", NULL, 0) == 0);
-       assert_true(errno == ERANGE);
-
-       errno = 0;
-       assert_true(strtoull_noneg("-0x10000000000000000", NULL, 0) == 0);
-       assert_true(errno == ERANGE);
-}