aboutsummaryrefslogtreecommitdiff
path: root/stdlib/strtod.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2001-08-07 04:37:18 +0000
committerUlrich Drepper <drepper@redhat.com>2001-08-07 04:37:18 +0000
commita529b416204403526663696b3dd9fbd567937b9b (patch)
treefc2b87dff24114f728540ff82a5753b745e30f01 /stdlib/strtod.c
parent70808a9bc6acb22db34258c903678a23e1d9a447 (diff)
downloadglibc-a529b416204403526663696b3dd9fbd567937b9b.zip
glibc-a529b416204403526663696b3dd9fbd567937b9b.tar.gz
glibc-a529b416204403526663696b3dd9fbd567937b9b.tar.bz2
Update.
2001-08-06 Jakub Jelinek <jakub@redhat.com> * stdlib/strtod.c (STRTOF): Skip whole infinity, not just inf. * stdio-common/vfscanf.c (__vfscanf): +- can be followed by i in +-Inf. * stdlib/tst-strtod.c (tests): Add Inf tests. * stdio-common/tstscanf.c (main): Add tests for +- before Inf. * locale/weightwc.h (findidx): Change type of i to int32_t.
Diffstat (limited to 'stdlib/strtod.c')
-rw-r--r--stdlib/strtod.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/stdlib/strtod.c b/stdlib/strtod.c
index bcd284c..db09384 100644
--- a/stdlib/strtod.c
+++ b/stdlib/strtod.c
@@ -573,15 +573,14 @@ INTERNAL (STRTOF) (nptr, endptr, group LOCALE_PARAM)
#endif
else if (c < L_('0') || c > L_('9'))
{
- int matched = 0;
/* Check for `INF' or `INFINITY'. */
- if (TOLOWER (c) == L_('i')
- && ((STRNCASECMP (cp, L_("inf"), 3) == 0 && (matched = 3))
- || (STRNCASECMP (cp, L_("infinity"), 8) == 0 && (matched = 8))))
+ if (TOLOWER (c) == L_('i') && STRNCASECMP (cp, L_("inf"), 3) == 0)
{
/* Return +/- infinity. */
if (endptr != NULL)
- *endptr = (STRING_TYPE *) (cp + matched);
+ *endptr = (STRING_TYPE *)
+ (cp + (STRNCASECMP (cp + 3, L_("inity"), 5) == 0
+ ? 8 : 3));
return negative ? -FLOAT_HUGE_VAL : FLOAT_HUGE_VAL;
}