/[gnats]/gnats/libiberty/strtod.c
ViewVC logotype

Diff of /gnats/libiberty/strtod.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by brendan, Thu Nov 5 19:54:16 1998 UTC revision 1.2 by pdm, Mon Dec 10 23:03:26 2001 UTC
# Line 22  the resulting executable to be covered b Line 22  the resulting executable to be covered b
22  This exception does not however invalidate any other reasons why  This exception does not however invalidate any other reasons why
23  the executable file might be covered by the GNU General Public License. */  the executable file might be covered by the GNU General Public License. */
24    
25  #include <ctype.h>  #include "ansidecl.h"
26    #include "safe-ctype.h"
27    
28  extern double atof ();  extern double atof ();
29    
# Line 42  strtod (str, ptr) Line 43  strtod (str, ptr)
43        
44    p = str;    p = str;
45        
46    while (isspace (*p))    while (ISSPACE (*p))
47      ++p;      ++p;
48        
49    if (*p == '+' || *p == '-')    if (*p == '+' || *p == '-')
# Line 88  strtod (str, ptr) Line 89  strtod (str, ptr)
89      }      }
90    
91    /* digits, with 0 or 1 periods in it.  */    /* digits, with 0 or 1 periods in it.  */
92    if (isdigit (*p) || *p == '.')    if (ISDIGIT (*p) || *p == '.')
93      {      {
94        int got_dot = 0;        int got_dot = 0;
95        while (isdigit (*p) || (!got_dot && *p == '.'))        while (ISDIGIT (*p) || (!got_dot && *p == '.'))
96          {          {
97            if (*p == '.')            if (*p == '.')
98              got_dot = 1;              got_dot = 1;
# Line 105  strtod (str, ptr) Line 106  strtod (str, ptr)
106            i = 1;            i = 1;
107            if (p[i] == '+' || p[i] == '-')            if (p[i] == '+' || p[i] == '-')
108              ++i;              ++i;
109            if (isdigit (p[i]))            if (ISDIGIT (p[i]))
110              {              {
111                while (isdigit (p[i]))                while (ISDIGIT (p[i]))
112                  ++i;                  ++i;
113                *ptr = p + i;                *ptr = p + i;
114                return atof (str);                return atof (str);

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.2

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26