[PATCH 1/2] diff: simplify quote_two()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Reimplement the function as a mere thin wrapper around
quote_two_c_style().

Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx>
---
 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




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux