Thread (13 messages) flat view 13 messages, 3 authors, 2016-06-15

Re: [PATCH V2 4/5] git-grep: Learn PCRE

From: Alex Riesen <hidden>
Date: 2016-06-15 22:51:09

2011/5/5 Michał Kiedrowicz [off-list ref]:
+#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.
+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...
quoted hunk ↗ jump to hunk
@@ -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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help