[PATCH] locale: Make _nl_C_locobj_ptr usable outside of libc

Florian Weimer fweimer@redhat.com
Mon Sep 19 14:33:00 GMT 2016


On 09/16/2016 01:53 PM, Florian Weimer wrote:
> I need something like this to fix incorrect locale dependence in
> libresolv (bug 19687).
>
> I tested this with the fixes, including one for nscd, which uses
> __libc_C_locobj@GLIBC_PRIVATE.  libresolv uses _nl_C_locobj@GLIBC_PRIVATE.
>
> I'm not entirely sure if we should use the function approach everywhere
> instead.  But as far as I can tell, this patch does not lead to the
> allocation of space for a _nl_C_locobj copy in libresolv (which we would
> not want because it is wasteful).
>
> An alternative would add of functions such as those in <ctype.h> and
> strcasecmp/strncasecmp which are always tied to the C locale.  This
> would be more efficient because access to the locale object is easier,
> or the variants can even be optimized inline (such as isblank).

This patch implements the alternative approach.  With it, is no longer 
necessary to export the C locale object.

I added __isdigit_C and __isxdigit_C implementations, although maybe 
they are not required because isdigit and isxdigit can be changed.

Beyond the new test, I checked that the approach works by converting a 
few configuration file parsers, and fixing the domain name comparisons 
in libresolv.

Florian

-------------- next part --------------
A non-text attachment was scrubbed...
Name: C-locale.patch
Type: text/x-patch
Size: 13727 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20160919/322e2e6a/attachment.bin>


More information about the Libc-alpha mailing list