bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nl_langinfo and localized day/month names


From: Paul Eggert
Subject: Re: nl_langinfo and localized day/month names
Date: Sat, 05 Jul 2014 14:59:05 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0

Thanks, I tried that out on Fedora 20 (pretending that its nl_langinfo didn't exist) and had some trouble building and testing it, indicating trouble for other POSIXish platforms. I fixed the problems I found. A few things:

* nl_langinfo (FRAC_DIGITS) returns a pointer to a character, not a string, and similarly for the other values representing tiny integers. There's no need for null-termination.

* struct tm might not have the traditional Unix v7 layout.

* Some code can be shared between rpl_nl_langinfo and nl_langinfo by hoisting it into a shared static function ctype_codeset.

* Often it's better to use char[][] constants instead of char *[] constants when strings don't vary in size much, as this avoids unnecessary relocations in shared libraries.

* I didn't follow why tmm had some members updated but not others. Does Microsoft strftime care about otherwise-unused struct tm members? If so, perhaps we should initialize all the members to a valid and consistent value; if not, let's not bother with anything but the minimal.

Revised proposed patch attached.

Attachment: 0001-nl_langinfo-CODESET-on-MS-Windows-and-more-items-fro.patch
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]