OSDN Git Service

Merge branch 'js/regexec-buf' into maint
[git-core/git.git] / grep.c
diff --git a/grep.c b/grep.c
index d7d00b8..1194d35 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -898,17 +898,6 @@ static int fixmatch(struct grep_pat *p, char *line, char *eol,
        }
 }
 
-static int regmatch(const regex_t *preg, char *line, char *eol,
-                   regmatch_t *match, int eflags)
-{
-#ifdef REG_STARTEND
-       match->rm_so = 0;
-       match->rm_eo = eol - line;
-       eflags |= REG_STARTEND;
-#endif
-       return regexec(preg, line, 1, match, eflags);
-}
-
 static int patmatch(struct grep_pat *p, char *line, char *eol,
                    regmatch_t *match, int eflags)
 {
@@ -919,7 +908,8 @@ static int patmatch(struct grep_pat *p, char *line, char *eol,
        else if (p->pcre_regexp)
                hit = !pcrematch(p, line, eol, match, eflags);
        else
-               hit = !regmatch(&p->regexp, line, eol, match, eflags);
+               hit = !regexec_buf(&p->regexp, line, eol - line, 1, match,
+                                  eflags);
 
        return hit;
 }