From: Sam S. <sd...@gn...> - 2011-08-24 16:33:56
|
> * Bruno Haible <oe...@py...> [2011-08-24 18:01:09 +0200]: > > Sam wrote: >> BTW, could you please explain this comment: >> >> /* Given the above, the following line is only needed for those platforms >> for which gettext is compiled with HAVE_LOCALE_NULL defined. */ > > On glibc systems, setlocale(cat,NULL) is known to return a locale string in the > expected format, and locales can be created by users. Therefore gettext() > uses setlocale(); on the other platforms gettext() relies on the environment > variables and the setlocale() call is therefore actually redundant. So what happens on those non-glibc systems where this call is redundant? Is NULL returned? >> At any rate, apparently you do not object to moving init_language past >> initmem and letting it indicate a failure as long as it does not prevent >> clisp from starting up. > > I'm not sure there aren't GETTEXT or GETTEXTL calls during initmem > or the rest of the start-up. yes, there are some. > If there are some, it seems safer to me to > - continue to call init_language as early as it is now, > - but store its result or success in some variable, and > - emit the warning message after everything is initialized. I want the warning to be more specific, so, I guess, init_language will have to take a flag arg indicating whether to warn with fprintf or signal with ERROR. >> 4. bind_textdomain_codeset --> errno != 0 (may return NULL on success!) > > This function can fail if malloc fails. I'm not aware that it could return NULL on success. RETURN VALUE If successful, the bind_textdomain_codeset function returns the current codeset for domain domainname, after possibly changing it. The result- ing string is valid until the next bind_textdomain_codeset call for the same domainname and must not be modified or freed. If a memory alloca- tion failure occurs, it sets errno to ENOMEM and returns NULL. If no codeset has been set for domain domainname, it returns NULL. I find the combination of the last two sentences confusing. They appear to indicate that either -- NULL return value does not necessarily indicate failure (e.g., if nothing has changed) -- It is possible that NULL is returned (i.e., the call failed) but errno is not set. The first option seems to actually contradict the first sentence, so, I guess, the second is correct. Right? Or, just like with bindtextdomain & textdomain, NULL return value == failure, and the manual page should be fixed? -- Sam Steingold (http://sds.podval.org/) on CentOS release 5.6 (Final) X 11.0.60900031 http://memri.org http://www.PetitionOnline.com/tap12009/ http://dhimmi.com http://truepeace.org http://palestinefacts.org http://www.memritv.org Computers are like air conditioners: they don't work with open windows! |