get_ref_dir(): take the containing directory as argument
[gitweb.git] / grep.c
diff --git a/grep.c b/grep.c
index 3821400966823ff6bf877abf94f4edea9b6b80c6..190139cfcd0d61f364a88010fe1dd6e71e26f9e2 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -79,7 +79,7 @@ static void compile_pcre_regexp(struct grep_pat *p, const struct grep_opt *opt)
 {
        const char *error;
        int erroffset;
-       int options = 0;
+       int options = PCRE_MULTILINE;
 
        if (opt->ignore_case)
                options |= PCRE_CASELESS;
@@ -168,15 +168,10 @@ static void compile_regexp(struct grep_pat *p, struct grep_opt *opt)
                p->fixed = 0;
 
        if (p->fixed) {
-               if (opt->regflags & REG_ICASE || p->ignore_case) {
-                       static char trans[256];
-                       int i;
-                       for (i = 0; i < 256; i++)
-                               trans[i] = tolower(i);
-                       p->kws = kwsalloc(trans);
-               } else {
+               if (opt->regflags & REG_ICASE || p->ignore_case)
+                       p->kws = kwsalloc(tolower_trans_tbl);
+               else
                        p->kws = kwsalloc(NULL);
-               }
                kwsincr(p->kws, p->pattern, p->patternlen);
                kwsprep(p->kws);
                return;