diff lib/strtod.c @ 13545:1531149632e8

strtod: fix const diagnostic * lib/strtod.c (strtod): Don't assign const char * to char *, as this elicits a warning from GCC when warnings are enabled.
author Paul Eggert <eggert@cs.ucla.edu>
date Tue, 10 Aug 2010 10:39:30 -0700
parents be8a41115d44
children d813f5516d9a
line wrap: on
line diff
--- a/lib/strtod.c	Thu Jun 10 15:12:48 2010 +0100
+++ b/lib/strtod.c	Tue Aug 10 10:39:30 2010 -0700
@@ -200,7 +200,8 @@
   double num;
 
   const char *s = nptr;
-  char *end;
+  const char *end;
+  char *endbuf;
 
   /* Eat whitespace.  */
   while (locale_isspace (*s))
@@ -211,7 +212,8 @@
   if (*s == '-' || *s == '+')
     ++s;
 
-  num = underlying_strtod (s, &end);
+  num = underlying_strtod (s, &endbuf);
+  end = endbuf;
 
   if (c_isdigit (s[*s == '.']))
     {
@@ -224,7 +226,10 @@
           if (! c_isxdigit (s[2 + (s[2] == '.')]))
             end = s + 1;
           else if (end <= s + 2)
-            num = parse_number (s + 2, 16, 2, 4, 'p', &end);
+            {
+              num = parse_number (s + 2, 16, 2, 4, 'p', &endbuf);
+              end = endbuf;
+            }
           else
             {
               const char *p = s + 2;