bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: major gawk bug


From: Stepan Kasal
Subject: Re: major gawk bug
Date: Wed, 9 Jun 2004 10:05:14 +0200
User-agent: Mutt/1.4.1i

Hello Arnold and Mr. Ievlev,

On Tue, Jun 08, 2004 at 06:59:48PM +0300, Aharon Robbins wrote:
> > I beleive the right fix for regexes is to use RE_ICASE flag instead
> > [...] comparisons; these should be replaced by a call to tolower().
...
> I have some tentative changes in place that work this way.  It passes
> `make check'.  I am still concerned about performance, especially
> the use of tolower().
> 
> If you or Mr. Ievlev can test them and give me some feedback, let
> me know and I'll send them to you.

To be frank, I'm quite busy mow and would have problems to find time
for the testing.  OTOH, I'd like to see things go this way, so if
Mr. Ievlev didn't do the testing, I'd try to manage to do it.

I admit that it's possible that some with tolower() could appear:

1) I hope that performance will be ok.  It really should be a
hardcoded chartable internally, one for each charset.
I've grepped this from GNU libc CVS:

#define _NL_CURRENT(category, item) \
  ((*_nl_current_##category)->values[_NL_ITEM_INDEX (item)].string)
#define __ctype_tolower \
  ((int32_t *) _NL_CURRENT (LC_CTYPE, _NL_CTYPE_TOLOWER) + 128)
int tolower (int c) {
  return c >= -128 && c < 256 ? __ctype_tolower[c] : c;
}

I believe that _nl_current_LC_CTYPE is a global variable and macro
_NL_ITEM_INDEX(_NL_CTYPE_TOLOWER) expands to a constant expression.

But I understand that performace drop might appear on some non-GNU
platforms.

2) When you grep intl/ subdir for tolower, you find out that Bruno
uses    (isalpha(c) ? tolower(c) : c)   because tolower chokes on some
buggy platforms.  I wouldn't use it by default.  But you may get bug
reports which boil down to this, so you may need to install this
wrapper for these buggy platforms later.

I hope my comments are not waste of your time.

Have a nice day,
        Stepan




reply via email to

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