Re: [PATCH V2 4/5] git-grep: Learn PCRE
- From
Alex Riesen <raa.lkml@gmail.com>
- Date
- May 5, 2011, 07:43 UTC
- Message-ID
- <BANLkTinXoDFyb9U0RJVb8eH269zj+XvBdQ@mail.gmail.com>
- In-Reply-To
- <1304546421-25439-5-git-send-email-michal.kiedrowicz@gmail.com>
2011/5/5 Michał Kiedrowicz <michal.kiedrowicz@gmail.com>:
Show 5 quoted lines
> +#ifdef NO_LIBPCRE
> +static void compile_pcre_regexp(struct grep_pat *p, struct grep_opt *opt)
> +{
> + die("cannot use Perl-compatible regexes when libpcre is not compiled in");
> +}Looks like these two functions below can be just left empty, because you will exit when calling compile_pcre_regexp in compile_regexp.
Show 11 quoted lines
> +static int pcrematch(struct grep_pat *p, char *line, char *eol,
> + regmatch_t *match, int eflags)
> +{
> + die("cannot use Perl-compatible regexes when libpcre is not compiled in");
> +}
> +
> +static void free_pcre_regexp(struct grep_pat *p)
> +{
> + die("cannot use Perl-compatible regexes when libpcre is not compiled in");
> +}
> +These will be never called, because...
Show 8 quoted lines
> @@ -70,6 +135,11 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
> if (p->fixed)
> return;
>
> + if (opt->pcre) {
> + compile_pcre_regexp(p, opt);
> + return;
> + }... you die here, if PCRE not available.