From: Junio C Hamano <gitster@pobox.com>
To: git@vger.kernel.org
Subject: [PATCH 1/2] diff: simplify quote_two()
Date: Wed, 15 Sep 2021 15:33:15 -0700 [thread overview]
Message-ID: <20210915223316.1653443-2-gitster@pobox.com> (raw)
In-Reply-To: <20210915223316.1653443-1-gitster@pobox.com>
Reimplement the function as a mere thin wrapper around
quote_two_c_style().
Signed-off-by: Junio C Hamano <gitster@pobox.com>
---
diff.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/diff.c b/diff.c
index a8113f1707..8143b737b7 100644
--- a/diff.c
+++ b/diff.c
@@ -482,19 +482,9 @@ int git_diff_basic_config(const char *var, const char *value, void *cb)
static char *quote_two(const char *one, const char *two)
{
- int need_one = quote_c_style(one, NULL, NULL, CQUOTE_NODQ);
- int need_two = quote_c_style(two, NULL, NULL, CQUOTE_NODQ);
struct strbuf res = STRBUF_INIT;
- if (need_one + need_two) {
- strbuf_addch(&res, '"');
- quote_c_style(one, &res, NULL, CQUOTE_NODQ);
- quote_c_style(two, &res, NULL, CQUOTE_NODQ);
- strbuf_addch(&res, '"');
- } else {
- strbuf_addstr(&res, one);
- strbuf_addstr(&res, two);
- }
+ quote_two_c_style(&res, one, two, 0);
return strbuf_detach(&res, NULL);
}
--
2.33.0-649-gd4f4107c2b
next prev parent reply other threads:[~2021-09-15 22:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-15 22:33 [PATCH 0/2] (experimental) diff --quote-path-with-sp Junio C Hamano
2021-09-15 22:33 ` Junio C Hamano [this message]
2021-09-15 22:33 ` [PATCH 2/2] diff: --quote-path-with-sp Junio C Hamano
2021-09-16 9:06 ` Ævar Arnfjörð Bjarmason
2021-09-16 20:59 ` Junio C Hamano
2021-09-16 3:33 ` [PATCH 0/2] (experimental) diff --quote-path-with-sp Gwyneth Morgan
2021-09-16 5:31 ` Junio C Hamano
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210915223316.1653443-2-gitster@pobox.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
/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.
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 NNTP newsgroup(s).