bug-gnulib
[Top][All Lists]
Advanced

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

[PATCH] improve locale handling in m4/wcwidth.m4


From: kc . REMOVE . SPAM
Subject: [PATCH] improve locale handling in m4/wcwidth.m4
Date: Mon, 13 Jul 2009 21:33:24 +0200
User-agent: Opera Mail/9.64 (Linux)

Hello,

the attached patch solves two problems with the current version of m4/wcwidth.m4 (serial 14). However, those two problems are so closely related that I chose to attack them in one patch.

The current version of gl_FUNC_WCWIDTH in m4/wcwidth.m4 tries to switch to an UTF-8 locale by switching to "fr_FR.UTF-8".

The first problem arises if the setlocale command fails (returning NULL). Then the actual test is not executed and the main function returns 0. This value indicates properly working wcwidth with UTF-8 locale. However, the test did not take place, as setlocale failed.

The first problem is the hard-coded locale name "fr_FR.UTF-8". I'd suppose using $LOCALE_FR_UTF8 from gt_LOCALE_FR_UTF8 is a saner choice.

I followed the lead of other gnulib m4 files (e.g.: m4/mbrlen.m4) and put a guard for "$LOCALE_FR_UTF8 = none" around the AC_TRY_RUN. Furthermore, I sanitized the C programs main return value if setlocale failed.

Kind regards,
kc

--
Do _not_ remove the ".REMOVE.SPAM" in the address.
It's a catch for too smart address harvesters

Attachment: wcwidth-locale.patch
Description: Binary data


reply via email to

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