This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: locale_t aware gettext() functions
Ulrich Drepper wrote:
> > Doing uselocale() each time the thread switches to a different session is
> > more a hack than an object-oriented implementation.
>
> I don't care about object-oriented.
Then the libglocale in gettext-0.15 will have a nicer API - more object
oriented, not tied to the thread - than glibc. Your choice.
> newlocale() is extremely fast, just a few pointer operations. It's the way
> to go.
newlocale() returns an object; this is fine. However, to use this object,
instead of
s = dgettext_l (domain, msgid, locale);
one has to write
uselocale (locale);
s = dgettext (domain, msgid, locale);
Is this faster? Four calls to __libc_tsd_set, just for nothing?
By the way, if uselocale() is really so cheap, why does libc have so many
*_l functions already? For example,
x = strtol_l (nptr, endptr, base, locale);
is equivalent to
uselocale (locale);
x = strtol (nptr, endptr, base);
Bruno