X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=lib%2Fstrtoimax.c;h=690e4d1513e98dc4bec463221feb70b0793891e8;hb=fcb62b60d94ad17c766dcdd94e4300163c670282;hp=cda6b44d0d875a64e85079e78e21f7a04e6cce94;hpb=01c35d722558a3dea0bf9b7f744ef6eec074b4f0;p=chaz%2Ftar diff --git a/lib/strtoimax.c b/lib/strtoimax.c index cda6b44..690e4d1 100644 --- a/lib/strtoimax.c +++ b/lib/strtoimax.c @@ -1,5 +1,6 @@ /* Convert string representation of a number into an intmax_t value. - Copyright 1999, 2001 Free Software Foundation, Inc. + + Copyright (C) 1999, 2001 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -65,12 +66,14 @@ long strtol PARAMS ((char const *, char **, int)); # ifndef HAVE_DECL_STRTOLL "this configure-time declaration test was not run" # endif -# if !HAVE_DECL_STRTOLL && HAVE_UNSIGNED_LONG_LONG +# if !HAVE_DECL_STRTOLL && HAVE_LONG_LONG long long strtoll PARAMS ((char const *, char **, int)); # endif #endif #ifdef UNSIGNED +# undef HAVE_LONG_LONG +# define HAVE_LONG_LONG HAVE_UNSIGNED_LONG_LONG # define INT uintmax_t # define strtoimax strtoumax # define strtol strtoul @@ -82,16 +85,16 @@ long long strtoll PARAMS ((char const *, char **, int)); INT strtoimax (char const *ptr, char **endptr, int base) { -#if HAVE_UNSIGNED_LONG_LONG +#if HAVE_LONG_LONG verify (size_is_that_of_long_or_long_long, - (sizeof (INT) == sizeof strtol (ptr, endptr, base) - || sizeof (INT) == sizeof strtoll (ptr, endptr, base))); + (sizeof (INT) == sizeof (long) + || sizeof (INT) == sizeof (long long))); - if (sizeof (INT) != sizeof strtol (ptr, endptr, base)) + if (sizeof (INT) != sizeof (long)) return strtoll (ptr, endptr, base); #else verify (size_is_that_of_long, - sizeof (INT) == sizeof strtol (ptr, endptr, base)); + sizeof (INT) == sizeof (long)); #endif return strtol (ptr, endptr, base);