From: Alejandro Colomar Date: Tue, 9 Jan 2024 13:49:34 +0000 (+0100) Subject: lib/atoi/strtou_noneg.[ch], tests/: strtoull_noneg(): Remove unused function X-Git-Tag: 4.15.2~11 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fb49de61b722adfce5b7e8f3d3e1d67ce908e966;p=thirdparty%2Fshadow.git lib/atoi/strtou_noneg.[ch], tests/: strtoull_noneg(): Remove unused function All call sites were replaced by a2i() recently. Reviewed-by: Iker Pedrosa Signed-off-by: Alejandro Colomar --- diff --git a/lib/atoi/strtou_noneg.c b/lib/atoi/strtou_noneg.c index ec8773d78..96a0b530e 100644 --- a/lib/atoi/strtou_noneg.c +++ b/lib/atoi/strtou_noneg.c @@ -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); diff --git a/lib/atoi/strtou_noneg.h b/lib/atoi/strtou_noneg.h index a1d155696..c9411d0ea 100644 --- a/lib/atoi/strtou_noneg.h +++ b/lib/atoi/strtou_noneg.h @@ -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 diff --git a/tests/unit/test_atoi_strtou_noneg.c b/tests/unit/test_atoi_strtou_noneg.c index 978bc0c49..60631210d 100644 --- a/tests/unit/test_atoi_strtou_noneg.c +++ b/tests/unit/test_atoi_strtou_noneg.c @@ -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); -}