This is the mail archive of the
libc-alpha@sources.redhat.com
mailing list for the glibc project.
Re: missing API for locale_t in <locale.h>
- From: Bruno Haible <bruno at clisp dot org>
- To: Roland McGrath <roland at redhat dot com>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Tue, 29 Mar 2005 13:58:57 +0200
- Subject: Re: missing API for locale_t in <locale.h>
- References: <200503281849.j2SInrkf025974@magilla.sf.frob.com>
Roland McGrath wrote:
> I'm considering putting in the following change, but I'd like some more
> opinions on it first.
Looks good to me.
The only point I'm not sure about is that a few lines below there is some
code that purports to avoid dragging in all categories at link time when
linking statically:
#elif defined NL_CURRENT_INDIRECT
/* Make direct reference to every _nl_current_CATEGORY symbol,
since we know only at runtime which categories are used. */
switch (category)
...
#else
data = _NL_CURRENT_DATA (category);
#endif
Is that code really useful? (nl_langinfo.os will drag in all categories
through the 'switch' statement, so what's the point?) If so, does it mean
that you need to add an "#elif defined NL_CURRENT_INDIRECT" case to
the new code that accesses _NL_CURRENT_LOCALE->__names[category];
as well?
> I'm not adding any sort of versioning to the interface to distinguish old
> ones without this support from new ones with.
That's OK. Applications can use a compile-time test for
#ifdef NL_LOCALE_NAME. I wouldn't care about applications which want to run
on older versions of glibc than the one they were compiled against, but
- as you say - this kind of situation can be covered through testing the
result against "".
Bruno