]> git.ipfire.org Git - thirdparty/git.git/commitdiff
grep: drop grep_buffer's "name" parameter
authorJeff King <peff@peff.net>
Thu, 2 Feb 2012 08:20:10 +0000 (03:20 -0500)
committerJunio C Hamano <gitster@pobox.com>
Thu, 2 Feb 2012 18:36:08 +0000 (10:36 -0800)
Before the grep_source interface existed, grep_buffer was
used by two types of callers:

  1. Ones which pulled a file into a buffer, and then wanted
     to supply the file's name for the output (i.e.,
     git grep).

  2. Ones which really just wanted to grep a buffer (i.e.,
     git log --grep).

Callers in set (1) should now be using grep_source. Callers
in set (2) always pass NULL for the "name" parameter of
grep_buffer. We can therefore get rid of this now-useless
parameter.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
grep.c
grep.h
revision.c

diff --git a/grep.c b/grep.c
index 8204ca25e550e3e1734d1c160f63a266f7a6749a..2a3fe7ce6fd9ad8afd38190362c3a622ad8526a3 100644 (file)
--- a/grep.c
+++ b/grep.c
@@ -1215,12 +1215,12 @@ int grep_source(struct grep_opt *opt, struct grep_source *gs)
        return grep_source_1(opt, gs, 0);
 }
 
-int grep_buffer(struct grep_opt *opt, const char *name, char *buf, unsigned long size)
+int grep_buffer(struct grep_opt *opt, char *buf, unsigned long size)
 {
        struct grep_source gs;
        int r;
 
-       grep_source_init(&gs, GREP_SOURCE_BUF, name, NULL);
+       grep_source_init(&gs, GREP_SOURCE_BUF, NULL, NULL);
        gs.buf = buf;
        gs.size = size;
 
diff --git a/grep.h b/grep.h
index e386ca4c7357cb52b8375fb3acfd872d57eee382..8bf3001417144815aef57db751a0762daf8a34a8 100644 (file)
--- a/grep.h
+++ b/grep.h
@@ -127,7 +127,7 @@ extern void append_grep_pattern(struct grep_opt *opt, const char *pat, const cha
 extern void append_header_grep_pattern(struct grep_opt *, enum grep_header_field, const char *);
 extern void compile_grep_patterns(struct grep_opt *opt);
 extern void free_grep_patterns(struct grep_opt *opt);
-extern int grep_buffer(struct grep_opt *opt, const char *name, char *buf, unsigned long size);
+extern int grep_buffer(struct grep_opt *opt, char *buf, unsigned long size);
 
 struct grep_source {
        char *name;
index 064e35108478431e82ec08464203fe119f24c1d6..89d3a8fafbe5d066a63c9b1f42113c7de5577c5c 100644 (file)
@@ -2128,7 +2128,6 @@ static int commit_match(struct commit *commit, struct rev_info *opt)
        if (!opt->grep_filter.pattern_list && !opt->grep_filter.header_list)
                return 1;
        return grep_buffer(&opt->grep_filter,
-                          NULL, /* we say nothing, not even filename */
                           commit->buffer, strlen(commit->buffer));
 }