bug-grep
[Top][All Lists]
Advanced

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

Re: [PATCH 5/9] dfa: optimize simple character sets under UTF-8 charsets


From: Paolo Bonzini
Subject: Re: [PATCH 5/9] dfa: optimize simple character sets under UTF-8 charsets
Date: Wed, 17 Mar 2010 12:03:56 +0100
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.8) Gecko/20100301 Fedora/3.0.3-1.fc12 Lightning/1.0b2pre Thunderbird/3.0.3


What do you think about dropping the global variable
and simply calling the function "using_utf8"?

static inline bool
using_utf8 (void)
{
   static bool utf8;
   static bool first_call = true;
   if (first_call)
     {
#ifdef HAVE_LANGINFO_CODESET
       utf8 = (strcmp (nl_langinfo (CODESET), "UTF-8") == 0);
#else
       utf8 = false;
#endif
       first_call = false;
     }

   return utf8;
}

Hmm... I guess we have to be leery of using "bool" in dfa.c since it's
slated to be shared with gawk (which lacks gnulib).  So we should
stick with "int" and 0/1.

Either way, ACK.

Pushed with the inline function.

Paolo




reply via email to

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