[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] ls: Use pretty UTF-8 arrow when showing where symlinks point
From: |
Pádraig Brady |
Subject: |
Re: [PATCH] ls: Use pretty UTF-8 arrow when showing where symlinks point to |
Date: |
Wed, 12 Aug 2009 10:54:08 +0100 |
User-agent: |
Thunderbird 2.0.0.6 (X11/20071008) |
Lennart Poettering wrote:
> On Tue, 11.08.09 22:27, Pádraig Brady (address@hidden) wrote:
>
>> this is equivalent I think:
>>
>> static const char *arrow = " -> ";
>> #ifdef HAVE_NL_LANGINFO
>> if (fancy_chars && STREQ (nl_langinfo (CODESET), "UTF-8"))
>> arrow = " \xe2\x86\x92 ";
>> #endif
>> DIRED_FPUTS_LITERAL (arrow, stdout);
>
> You evaluate the whole expression on every iteration. The whole point
> of making this variable static is to make sure this isn't necessary.
Oh right, so something like:
static const char *arrow;
if (!arrow)
{
if (fancy_chars && STREQ (locale_charset(), "UTF-8"))
arrow = " \xe2\x86\x92 ";
else
arrow = " -> ";
}
DIRED_FPUTS_LITERAL (arrow, stdout);
Note the use of locale_charset() from gnulib for portability.
cheers,
Pádraig.