[PATCH] Speed-up character range regexes by up to 2x

Aharon Robbins arnold@skeeve.com
Mon Jan 12 13:54:00 GMT 2004


> >>What follows the review of the "gawk guy"'s regex patch:
> >>
> >> > +#ifdef RE_ENABLE_I18N
> >> >    int icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));
> >> > +#else
> >> > +  int icase = (bufp->syntax & RE_ICASE);
> >> > +#endif
> >>
> >>This is unneeded.
> >>    
> >>
> I mean that you probably added these fixes when MB_CUR_MAX was used 
> because somebody got link errors for MB_CUR_MAX undefined; but now, 
> dfa->mb_cur_max cannot possibly be undefined and will always be 1 if 
> !RE_ENABLE_I18N.

You're missing my point.  Look again at the code.  If RE_ENABLE_I18N
isn't defined, there's no declaration at all for `icase'.  But `icase'
is used in plain code, outside of any #ifdef for RE_ENABLE_I18N.  It may
be that the correct patch is simply to use:

	int icase = (dfa->mb_cur_max == 1 && (bufp->syntax & RE_ICASE));

with no surrounding #ifdef.  If so, fine.

Thanks,

Arnold



More information about the Libc-alpha mailing list