mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
Clear errno, just to be sure.
This commit is contained in:
parent
a534ed3ee7
commit
5afc74757b
1 changed files with 8 additions and 1 deletions
|
@ -1,6 +1,8 @@
|
||||||
/* This is not a proper strtod() implementation, but sufficient for Python.
|
/* This is not a proper strtod() implementation, but sufficient for Python.
|
||||||
Python won't detect floating point constant overflow, though. */
|
Python won't detect floating point constant overflow, though. */
|
||||||
|
|
||||||
|
extern int errno;
|
||||||
|
|
||||||
extern int strlen();
|
extern int strlen();
|
||||||
extern double atof();
|
extern double atof();
|
||||||
|
|
||||||
|
@ -9,7 +11,12 @@ strtod(p, pp)
|
||||||
char *p;
|
char *p;
|
||||||
char **pp;
|
char **pp;
|
||||||
{
|
{
|
||||||
|
double res;
|
||||||
|
|
||||||
if (pp)
|
if (pp)
|
||||||
*pp = p + strlen(p);
|
*pp = p + strlen(p);
|
||||||
return atof(p);
|
res = atof(p);
|
||||||
|
errno = 0;
|
||||||
|
return res;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue