lib/atoi/strtou_noneg.[ch], tests/: strtoull_noneg(): Remove unused function

All call sites were replaced by a2i() recently.

Reviewed-by: Iker Pedrosa <ipedrosa@redhat.com>
Signed-off-by: Alejandro Colomar <alx@kernel.org>
This commit is contained in:
Alejandro Colomar
2024-05-27 16:32:09 +02:00
parent 895dfd77d2
commit fb49de61b7
3 changed files with 0 additions and 40 deletions
-2
View 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);
-14
View 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
-24
View 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);
}