Bruno Haible wrote:
> Paolo Bonzini wrote:
>> > + c_locale = newlocale (LC_ALL_MASK, "C", (locale_t)0);
>>
>> Can we cache c_locale in a static variable?
>
> This would make sense for speed, yes. (Think of calling c_strtod in a loop,
> like it is done in getloadavg.c.) Here is a proposed patch. O
se...@seebs.net (Peter Seebach) writes:
> In message <200901212258.n0lmwqx07...@f7.net>, Karl Berry writes:
>>I am surprised. I thought 0 was supposed to be a valid null pointer in
>>all contexts, without casting.
>
> 0 is a null pointer constant. In a context where the language anticipates
> a
In message <200901212258.n0lmwqx07...@f7.net>, Karl Berry writes:
>I am surprised. I thought 0 was supposed to be a valid null pointer in
>all contexts, without casting.
0 is a null pointer constant. In a context where the language anticipates
a pointer, a null pointer constant becomes a null po
> I suppose NULL isn't necessarily defined
Hard to imagine.
POSIX explicitly mentions (locale_t)0
I am surprised. I thought 0 was supposed to be a valid null pointer in
all contexts, without casting.
Paolo Bonzini wrote:
> > + c_locale = newlocale (LC_ALL_MASK, "C", (locale_t)0);
>
> Can we cache c_locale in a static variable?
This would make sense for speed, yes. (Think of calling c_strtod in a loop,
like it is done in getloadavg.c.) Here is a proposed patch. OK, Jim?
2009-01-21 Bruno Ha
Hi Jim,
> I prefer to avoid casts, so please use this test instead:
>
> if (!c_locale)
If you prefer this way. I committed it like you say.
> > + c_locale = newlocale (LC_ALL_MASK, "C", (locale_t)0);
>
> I suppose NULL isn't necessarily defined
POSIX explicitly mentions (locale_t)0. I s
Bruno Haible wrote:
> Here's a proposed patch to improve c_strtod's error checking:
> 1) It currently does not check against a NULL return from newlocale(),
>which can happen for example if out of memory.
> 2) When strtod_l or strtod returns an error, c_strtod fails to preserve
>errno as a
> - locale_t c_locale = newlocale (LC_ALL_MASK, "C", 0);
> + locale_t c_locale;
> + int saved_errno;
> +
> + c_locale = newlocale (LC_ALL_MASK, "C", (locale_t)0);
Can we cache c_locale in a static variable?
Paolo
Hi Jim,
Here's a proposed patch to improve c_strtod's error checking:
1) It currently does not check against a NULL return from newlocale(),
which can happen for example if out of memory.
2) When strtod_l or strtod returns an error, c_strtod fails to preserve
errno as an error indicator.
OK