From 6d53f16aa508c445309aa4ebe965baa9e17401a1 Mon Sep 17 00:00:00 2001 From: aqua Date: Sun, 6 Nov 2022 14:48:41 +0200 Subject: lib: migrate tests to gtest --- lib/string/itoa.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) (limited to 'lib/string') diff --git a/lib/string/itoa.c b/lib/string/itoa.c index 3708be2..2db9768 100644 --- a/lib/string/itoa.c +++ b/lib/string/itoa.c @@ -3,18 +3,6 @@ static const char *numbers = "0123456789abcdef"; -char * -itoa(char *p, int x, int base) -{ - const bool is_negative = (x < 0); - if (is_negative) x = -x; - - p = utoa(p, x, base); - - if (is_negative) *--p = '-'; - return p; -} - char * utoa(char *p, unsigned x, int base) { @@ -28,3 +16,15 @@ utoa(char *p, unsigned x, int base) return p; } + +char * +itoa(char *p, int x, int base) +{ + const bool is_negative = (x < 0); + if (is_negative) x = -x; + + p = utoa(p, x, base); + + if (is_negative) *--p = '-'; + return p; +} -- cgit v1.2.1