From: Brandon Williams <bmwill@google.com>
To: git@vger.kernel.org
Cc: Brandon Williams <bmwill@google.com>,
gitster@pobox.com, rahul.bedarkar@imgtec.com
Subject: [PATCH 1/2] grep: set default output method
Date: Fri, 17 Mar 2017 11:41:54 -0700 [thread overview]
Message-ID: <20170317184155.128674-1-bmwill@google.com> (raw)
In-Reply-To: <20170317182403.GA110341@google.com>
Signed-off-by: Brandon Williams <bmwill@google.com>
---
grep.c | 12 +++++++-----
1 file changed, 7 insertions(+), 5 deletions(-)
diff --git a/grep.c b/grep.c
index 0dbdc1d00..56ef0ecbf 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)
{
--
2.12.0.367.g23dc2f6d3c-goog
next prev parent reply other threads:[~2017-03-17 18:43 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-17 5:47 [PATCH] grep: fix build with no thread support Rahul Bedarkar
2017-03-17 17:53 ` Junio C Hamano
2017-03-17 18:24 ` Brandon Williams
2017-03-17 18:41 ` Brandon Williams [this message]
2017-03-17 18:41 ` [PATCH 2/2] grep: fix builds with " Brandon Williams
2017-03-17 23:00 ` Jonathan Nieder
2017-03-20 5:55 ` Rahul Bedarkar
2017-03-17 18:47 ` [PATCH] grep: fix build " Brandon Williams
2017-03-17 22:37 ` Jeff King
2017-03-17 22:42 ` Brandon Williams
2017-03-17 22:58 ` Jeff King
2017-03-17 23:03 ` Brandon Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170317184155.128674-1-bmwill@google.com \
--to=bmwill@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=rahul.bedarkar@imgtec.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).