1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* util.c (ruby_strtod): clear errno at the top of our own

impelementation of strtod(3).  [ruby-dev:34834] [ruby-dev:34839]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16612 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-05-26 07:51:46 +00:00
parent cf5cf236d7
commit c2257734e3
3 changed files with 3 additions and 5 deletions

View file

@ -66,8 +66,8 @@ Sun May 25 02:37:25 2008 Koichi Sasada <ko1@atdot.net>
Sat May 24 22:32:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org> Sat May 24 22:32:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* object.c (rb_cstr_to_dbl): should clear errno before calling * util.c (ruby_strtod): clear errno at the top of our own
strtod(3). [ruby-dev:34834] impelementation of strtod(3). [ruby-dev:34834] [ruby-dev:34839]
Sat May 24 15:26:16 2008 Yusuke Endoh <mame@tsg.ne.jp> Sat May 24 15:26:16 2008 Yusuke Endoh <mame@tsg.ne.jp>

View file

@ -2045,7 +2045,6 @@ rb_cstr_to_dbl(const char *p, int badcheck)
if (!p) return 0.0; if (!p) return 0.0;
q = p; q = p;
while (ISSPACE(*p)) p++; while (ISSPACE(*p)) p++;
errno = 0;
d = strtod(p, &end); d = strtod(p, &end);
if (errno == ERANGE) { if (errno == ERANGE) {
OutOfRange(); OutOfRange();

3
util.c
View file

@ -1000,8 +1000,6 @@ static double private_mem[PRIVATE_mem], *pmem_next = private_mem;
#define IEEE_Arith #define IEEE_Arith
#endif #endif
#include "errno.h"
#ifdef Bad_float_h #ifdef Bad_float_h
#ifdef IEEE_Arith #ifdef IEEE_Arith
@ -2206,6 +2204,7 @@ ruby_strtod(const char *s00, char **se)
const char *s2; const char *s2;
#endif #endif
errno = 0;
sign = nz0 = nz = 0; sign = nz0 = nz = 0;
dval(rv) = 0.; dval(rv) = 0.;
for (s = s00;;s++) for (s = s00;;s++)