Merge branch 'maint'
[gitweb.git] / grep.c
diff --git a/grep.c b/grep.c
index cace1c8bcb4402f9738ae124b908324b68ff91b3..f3a27d7d6e141bd8813b978edbe33d16aa764fb4 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -192,7 +192,8 @@ void compile_grep_patterns(struct grep_opt *opt)
         * A classic recursive descent parser would do.
         */
        p = opt->pattern_list;
-       opt->pattern_expression = compile_pattern_expr(&p);
+       if (p)
+               opt->pattern_expression = compile_pattern_expr(&p);
        if (p)
                die("incomplete pattern expression: %s", p->pattern);
 }
@@ -490,9 +491,9 @@ static void show_line(struct grep_opt *opt, char *bol, char *eol,
                *eol = '\0';
                while (next_match(opt, bol, eol, ctx, &match, eflags)) {
                        printf("%.*s%s%.*s%s",
-                              match.rm_so, bol,
+                              (int)match.rm_so, bol,
                               opt->color_match,
-                              match.rm_eo - match.rm_so, bol + match.rm_so,
+                              (int)(match.rm_eo - match.rm_so), bol + match.rm_so,
                               GIT_COLOR_RESET);
                        bol += match.rm_eo;
                        rest -= match.rm_eo;