From: Duy Nguyen Date: Wed, 08 Jul 2015 11:00:34 GMT Subject: Re: [PATCH v2 5/9] grep/pcre: prepare locale-dependent tables for icase matching Message-ID: In-Reply-To: <1436351919-2520-6-git-send-email-pclouds@gmail.com> On Wed, Jul 8, 2015 at 5:38 PM, Nguyễn Thái Ngọc Duy wrote: > diff --git a/grep.c b/grep.c > index 8fce54f..c79aa70 100644 > --- a/grep.c > +++ b/grep.c > @@ -324,11 +324,13 @@ static void compile_pcre_regexp(struct grep_pat *p, const struct grep_opt *opt) > int erroffset; > int options = PCRE_MULTILINE; > > - if (opt->ignore_case) > + if (opt->ignore_case) { > + p->pcre_tables = pcre_maketables(); This affects ascii-only case too because I didn't use has_non_ascii() here. I guess it's ok because the doc says there are default tables anyway. But I'm not really familiar with pcre... If they have optimizations for when the last argument of pcre_compile() is NULL, we have a regression. > options |= PCRE_CASELESS; > + } > > p->pcre_regexp = pcre_compile(p->pattern, options, &error, &erroffset, > - NULL); > + p->pcre_tables); > if (!p->pcre_regexp) > compile_regexp_failed(p, error); > -- Duy