Re: [PATCH v2 5/9] grep/pcre: prepare locale-dependent tables for icase matching
- From
Duy Nguyen <pclouds@gmail.com>
- Date
- Jul 8, 2015, 11:00 UTC
- Message-ID
- <CACsJy8AiuiY=scqaH57wYVk4sWvvb0ddJzJGs+iaRj9ouHfCqw@mail.gmail.com>
- 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 <pclouds@gmail.com> wrote:
Show 11 quoted lines
> 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.
Show 9 quoted lines
> 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