From f84fbc32cb1ac619ca52a531af07ee604aeb7a36 Mon Sep 17 00:00:00 2001 From: Olaf Barthel Date: Wed, 28 Sep 2005 09:51:16 +0000 Subject: [PATCH] - The ERANGE initialization is not necessary. git-svn-id: file:///Users/olsen/Code/migration-svn-zu-git/logical-line-staging/clib2/trunk@15031 87f5fb63-7c3d-0410-a384-fd976d0f7a62 --- library/changes | 5 ++--- library/inttypes_strtoimax.c | 5 +---- library/inttypes_strtoumax.c | 5 +---- library/stdlib_strtod.c | 4 +--- library/stdlib_strtof.c | 4 +--- library/stdlib_strtol.c | 5 +---- library/stdlib_strtoll.c | 5 +---- library/stdlib_strtoul.c | 5 +---- library/stdlib_strtoull.c | 5 +---- 9 files changed, 10 insertions(+), 33 deletions(-) diff --git a/library/changes b/library/changes index b23ef46..9c63414 100644 --- a/library/changes +++ b/library/changes @@ -1,9 +1,8 @@ - strtoimax(), strtoumax(), strtod(), strtof(), strtol(), strtoll(), strtoul() and strtoull() now count how many digits were converted. If that number is zero, then the conversion is considered to have - failed: 0 is returned, errno is set to ERANGE and the 'ptr' parameter - reference is initialized with a pointer to the string to be converted. - This has two consequences: + failed: 0 is returned and the 'ptr' parameter reference is initialized + with a pointer to the string to be converted. This has two consequences: 1) A floating point number that has no digits in the significand is no longer converted to zero. For example ".e10" can no longer diff --git a/library/inttypes_strtoimax.c b/library/inttypes_strtoimax.c index cb01151..93d307d 100644 --- a/library/inttypes_strtoimax.c +++ b/library/inttypes_strtoimax.c @@ -1,5 +1,5 @@ /* - * $Id: inttypes_strtoimax.c,v 1.2 2005-09-28 09:28:39 obarthel Exp $ + * $Id: inttypes_strtoimax.c,v 1.3 2005-09-28 09:51:16 obarthel Exp $ * * :ts=4 * @@ -181,10 +181,7 @@ strtoimax(const char *str, char **ptr, int base) /* Did we convert anything? */ if(num_digits_converted == 0) - { - __set_errno(ERANGE); goto out; - } if(is_negative) result = (-sum); diff --git a/library/inttypes_strtoumax.c b/library/inttypes_strtoumax.c index acaa3d1..21bb771 100644 --- a/library/inttypes_strtoumax.c +++ b/library/inttypes_strtoumax.c @@ -1,5 +1,5 @@ /* - * $Id: inttypes_strtoumax.c,v 1.2 2005-09-28 09:28:39 obarthel Exp $ + * $Id: inttypes_strtoumax.c,v 1.3 2005-09-28 09:51:16 obarthel Exp $ * * :ts=4 * @@ -182,10 +182,7 @@ strtoumax(const char *str, char **ptr, int base) /* Did we convert anything? */ if(num_digits_converted == 0) - { - __set_errno(ERANGE); goto out; - } if(is_negative) result = (-sum); diff --git a/library/stdlib_strtod.c b/library/stdlib_strtod.c index be71d0a..d7d60c6 100644 --- a/library/stdlib_strtod.c +++ b/library/stdlib_strtod.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_strtod.c,v 1.9 2005-09-28 09:28:39 obarthel Exp $ + * $Id: stdlib_strtod.c,v 1.10 2005-09-28 09:51:16 obarthel Exp $ * * :ts=4 * @@ -364,8 +364,6 @@ strtod(const char *str, char ** ptr) if(num_digits_converted == 0) { - __set_errno(ERANGE); - sum = 0; } else diff --git a/library/stdlib_strtof.c b/library/stdlib_strtof.c index ad3aa38..fed6a60 100644 --- a/library/stdlib_strtof.c +++ b/library/stdlib_strtof.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_strtof.c,v 1.9 2005-09-28 09:28:39 obarthel Exp $ + * $Id: stdlib_strtof.c,v 1.10 2005-09-28 09:51:16 obarthel Exp $ * * :ts=4 * @@ -364,8 +364,6 @@ strtof(const char *str, char ** ptr) if(num_digits_converted == 0) { - __set_errno(ERANGE); - sum = 0; } else diff --git a/library/stdlib_strtol.c b/library/stdlib_strtol.c index fc24b14..f3ba314 100644 --- a/library/stdlib_strtol.c +++ b/library/stdlib_strtol.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_strtol.c,v 1.4 2005-09-28 09:28:39 obarthel Exp $ + * $Id: stdlib_strtol.c,v 1.5 2005-09-28 09:51:16 obarthel Exp $ * * :ts=4 * @@ -181,10 +181,7 @@ strtol(const char *str, char **ptr, int base) /* Did we convert anything? */ if(num_digits_converted == 0) - { - __set_errno(ERANGE); goto out; - } if(is_negative) result = (-sum); diff --git a/library/stdlib_strtoll.c b/library/stdlib_strtoll.c index a6859eb..7541970 100644 --- a/library/stdlib_strtoll.c +++ b/library/stdlib_strtoll.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_strtoll.c,v 1.4 2005-09-28 09:28:39 obarthel Exp $ + * $Id: stdlib_strtoll.c,v 1.5 2005-09-28 09:51:16 obarthel Exp $ * * :ts=4 * @@ -185,10 +185,7 @@ strtoll(const char *str, char **ptr, int base) /* Did we convert anything? */ if(num_digits_converted == 0) - { - __set_errno(ERANGE); goto out; - } if(is_negative) result = (-sum); diff --git a/library/stdlib_strtoul.c b/library/stdlib_strtoul.c index 0a337c7..278c420 100644 --- a/library/stdlib_strtoul.c +++ b/library/stdlib_strtoul.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_strtoul.c,v 1.4 2005-09-28 09:28:39 obarthel Exp $ + * $Id: stdlib_strtoul.c,v 1.5 2005-09-28 09:51:16 obarthel Exp $ * * :ts=4 * @@ -178,10 +178,7 @@ strtoul(const char *str, char **ptr, int base) /* Did we convert anything? */ if(num_digits_converted == 0) - { - __set_errno(ERANGE); goto out; - } if(is_negative) result = (-sum); diff --git a/library/stdlib_strtoull.c b/library/stdlib_strtoull.c index 090dc94..5b1de89 100644 --- a/library/stdlib_strtoull.c +++ b/library/stdlib_strtoull.c @@ -1,5 +1,5 @@ /* - * $Id: stdlib_strtoull.c,v 1.4 2005-09-28 09:28:39 obarthel Exp $ + * $Id: stdlib_strtoull.c,v 1.5 2005-09-28 09:51:16 obarthel Exp $ * * :ts=4 * @@ -182,10 +182,7 @@ strtoull(const char *str, char **ptr, int base) /* Did we convert anything? */ if(num_digits_converted == 0) - { - __set_errno(ERANGE); goto out; - } if(is_negative) result = (-sum);