]> git.ipfire.org Git - thirdparty/git.git/blobdiff - grep.c
grep: extract grep_binexp() from grep_or_expr()
[thirdparty/git.git] / grep.c
diff --git a/grep.c b/grep.c
index bdbd06d437bf0bb1b0af2febecd6dec58ea529d9..d772fe6cc52af488dfda9f5968522806119f3e0e 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -603,15 +603,22 @@ static struct grep_expr *grep_not_expr(struct grep_expr *expr)
        return z;
 }
 
-static struct grep_expr *grep_or_expr(struct grep_expr *left, struct grep_expr *right)
+static struct grep_expr *grep_binexp(enum grep_expr_node kind,
+                                    struct grep_expr *left,
+                                    struct grep_expr *right)
 {
        struct grep_expr *z = xcalloc(1, sizeof(*z));
-       z->node = GREP_NODE_OR;
+       z->node = kind;
        z->u.binary.left = left;
        z->u.binary.right = right;
        return z;
 }
 
+static struct grep_expr *grep_or_expr(struct grep_expr *left, struct grep_expr *right)
+{
+       return grep_binexp(GREP_NODE_OR, left, right);
+}
+
 static struct grep_expr *compile_pattern_or(struct grep_pat **);
 static struct grep_expr *compile_pattern_atom(struct grep_pat **list)
 {