Re: c-strtod: handling of out-of-memory

2009-01-24 Thread Bruno Haible
Hi Jim, > > + If ENDPTR is not NULL, set *ENDPTR to point to the first byte beyond the > > + parsed number or to NPTR if the string does not start with a parseable > > + number. > > Perhaps mention that *ENDPTR is always set? I think this is implicit by the fact that this paragraph comes b

Re: c-strtod: handling of out-of-memory

2009-01-24 Thread Eric Blake
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 According to Bruno Haible on 1/24/2009 3:44 AM: > + Return value: > + - If successful, return the value as a double or 'long double', > + respectively, and don't modify errno. > + - In case of overflow, return ±HUGE_VAL or ±HUGE_VALL, respect

Re: c-strtod: handling of out-of-memory

2009-01-24 Thread Jim Meyering
Bruno Haible wrote: > Yup, thanks. Committed with this fix, and a bit nicer formatting: Nicer indeed. > +/* Parse the initial portion of the string pointed to by NPTR as a floating- > + point number (in decimal or hexadecimal notation), like in the C locale: > + accepting only the ASCII digi

Re: c-strtod: handling of out-of-memory

2009-01-24 Thread Bruno Haible
Hi Jim, > Thanks for writing that. One nit: s/the a/a/ Yup, thanks. Committed with this fix, and a bit nicer formatting: 2009-01-24 Bruno Haible * lib/c-strtod.h (c_strtod, c_strtold): Add specification. --- lib/c-strtod.h.orig 2009-01-24 11:42:56.0 +0100 +++ lib/c-strtod.

Re: c-strtod: handling of out-of-memory

2009-01-24 Thread Jim Meyering
Bruno Haible wrote: > 2009-01-23 Bruno Haible > > * lib/c-strtod.h (c_strtod, c_strtold): Add specification. Hi Bruno, > --- lib/c-strtod.h.orig 2009-01-24 00:08:16.0 +0100 > +++ lib/c-strtod.h2009-01-24 00:07:51.0 +0100 ... > + If successful, return the valu

Re: c-strtod: handling of out-of-memory

2009-01-23 Thread Bruno Haible
Hi Jim, > Once you've adjusted your patch to do the same for the > new return path it adds, you're welcome to commit it. Done. > *ENDPTR is no longer guaranteed to be set. Whee, well spotted. I missed this most probably because there was no documentation nearby that would have reminded me of th

Re: c-strtod: handling of out-of-memory

2009-01-23 Thread Jim Meyering
Bruno Haible wrote: > Now, when there is an out-of-memory while c_strtod is called, the handling is > inconsistent: > - If it occurs inside newlocale() or inside strtod_l() or inside strtod(), > the function returns 0 with errno set to ENOMEM. > - If it occurs inside strdup() of the locale

c-strtod: handling of out-of-memory

2009-01-22 Thread Bruno Haible
Now, when there is an out-of-memory while c_strtod is called, the handling is inconsistent: - If it occurs inside newlocale() or inside strtod_l() or inside strtod(), the function returns 0 with errno set to ENOMEM. - If it occurs inside strdup() of the locale string, the function calls