From 4a0ea7553a297d2a846ef2dd4d417fa6936251c8 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Sun, 12 May 2002 00:32:39 +0000 Subject: Several bugfixes for problems that showed up on alpha -Erik --- libc/stdio/printf.c | 2 +- libc/stdlib/stdlib.c | 26 +++++++++++++++++++------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index 407bf1d8b..92b5b5956 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -2091,7 +2091,7 @@ extern uintmax_t _load_inttype(int desttype, const void *src, int uflag) #if LONG_MAX != INT_MAX if (desttype & (PA_FLAG_LONG|PA_FLAG_LONG_LONG)) { #ifdef LLONG_MAX - if (destsize == PA_FLAG_LONG_LONG) { + if (desttype == PA_FLAG_LONG_LONG) { return *((long long int *) src); } #endif diff --git a/libc/stdlib/stdlib.c b/libc/stdlib/stdlib.c index 101debb40..d909417be 100644 --- a/libc/stdlib/stdlib.c +++ b/libc/stdlib/stdlib.c @@ -82,7 +82,10 @@ strong_alias(labs,abs) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(labs,llabs) +long long int llabs (long long int j) +{ + return (j >= 0) ? j : -j; +} #endif #if ULONG_MAX == UINTMAX_MAX @@ -133,7 +136,10 @@ strong_alias(atol,atoi) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(atol,atoll) +long long int atoll (const char *nptr) +{ + return strtol(nptr, (char **) NULL, 10); +} #endif long atol(const char *nptr) @@ -163,14 +169,16 @@ strong_alias(strtol,strtoimax) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(strtol,strtoll) +long long int strtoll (__const char *__restrict str, char **__restrict endptr, int base) +{ + return _stdlib_strto_l(str, endptr, base, 1); +} #endif long strtol(const char * __restrict str, char ** __restrict endptr, int base) { return _stdlib_strto_l(str, endptr, base, 1); } - #endif /**********************************************************************/ #ifdef L_strtoll @@ -198,11 +206,15 @@ strong_alias(strtoul,strtoumax) #endif #if defined(ULLONG_MAX) && (ULLONG_MAX == ULONG_MAX) -strong_alias(strtoul,strtoull) +unsigned long long int strtoull (__const char *__restrict str, + char **__restrict endptr, int base) +{ + return _stdlib_strto_l(str, endptr, base, 0); +} #endif -unsigned long strtoul(const char * __restrict str, - char ** __restrict endptr, int base) +unsigned long strtoul(const char * __restrict str, + char ** __restrict endptr, int base) { return _stdlib_strto_l(str, endptr, base, 0); } -- cgit v1.2.3