summaryrefslogtreecommitdiff
path: root/grep.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2017-03-28 14:05:57 -0700
committerJunio C Hamano <gitster@pobox.com>2017-03-28 14:05:57 -0700
commitff8b7e63dede832e8a02ce632fc70dcb59bf2681 (patch)
tree6deff66999eaa59bd884cd18c2509481db2e36d1 /grep.c
parente0ef7fe78c46e6919d249b9547948a3bb7321dea (diff)
parent2225e1ea20481a7c0da526891470abf9ece623e7 (diff)
downloadgit-ff8b7e63dede832e8a02ce632fc70dcb59bf2681.tar.gz
Merge branch 'bw/grep-recurse-submodules'
Build fix for NO_PTHREADS build. * bw/grep-recurse-submodules: grep: fix builds with with no thread support grep: set default output method
Diffstat (limited to 'grep.c')
-rw-r--r--grep.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/grep.c b/grep.c
index 0dbdc1d007..56ef0ecbff 100644
--- a/grep.c
+++ b/grep.c
@@ -12,6 +12,11 @@ static int grep_source_is_binary(struct grep_source *gs);
static struct grep_opt grep_defaults;
+static void std_output(struct grep_opt *opt, const void *buf, size_t size)
+{
+ fwrite(buf, size, 1, stdout);
+}
+
/*
* Initialize the grep_defaults template with hardcoded defaults.
* We could let the compiler do this, but without C99 initializers
@@ -42,6 +47,7 @@ void init_grep_defaults(void)
color_set(opt->color_selected, "");
color_set(opt->color_sep, GIT_COLOR_CYAN);
opt->color = -1;
+ opt->output = std_output;
}
static int parse_pattern_type_arg(const char *opt, const char *arg)
@@ -152,6 +158,7 @@ void grep_init(struct grep_opt *opt, const char *prefix)
opt->pathname = def->pathname;
opt->regflags = def->regflags;
opt->relative = def->relative;
+ opt->output = def->output;
color_set(opt->color_context, def->color_context);
color_set(opt->color_filename, def->color_filename);
@@ -1379,11 +1386,6 @@ static int look_ahead(struct grep_opt *opt,
return 0;
}
-static void std_output(struct grep_opt *opt, const void *buf, size_t size)
-{
- fwrite(buf, size, 1, stdout);
-}
-
static int fill_textconv_grep(struct userdiff_driver *driver,
struct grep_source *gs)
{