From ca9da0d810096e5a2f672b6b9c82a58d1a04ce13 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 8 Oct 2015 00:05:49 +0200 Subject: [PATCH 1/2] quote: fix broken sq_quote_buf() related comment Since 77d604c (Enhanced sq_quote(), 10 Oct 2005), the comment at the beginning of quote.c is broken. Let's fix it. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- quote.c | 1 + 1 file changed, 1 insertion(+) diff --git a/quote.c b/quote.c index 7920e18e44..890885a736 100644 --- a/quote.c +++ b/quote.c @@ -7,6 +7,7 @@ int quote_path_fully = 1; /* Help to copy the thing properly quoted for the shell safety. * any single quote is replaced with '\'', any exclamation point * is replaced with '\!', and the whole thing is enclosed in a + * single quote pair. * * E.g. * original sq_quote result From 44cd91eab2992cbf63c789321f16c087696ce324 Mon Sep 17 00:00:00 2001 From: Christian Couder Date: Thu, 8 Oct 2015 00:05:50 +0200 Subject: [PATCH 2/2] quote: move comment before sq_quote_buf() A big comment at the beginning of quote.c is really related to sq_quote_buf(), so let's move it in front of this function. Signed-off-by: Christian Couder Signed-off-by: Junio C Hamano --- quote.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/quote.c b/quote.c index 890885a736..fe884d2452 100644 --- a/quote.c +++ b/quote.c @@ -4,6 +4,11 @@ int quote_path_fully = 1; +static inline int need_bs_quote(char c) +{ + return (c == '\'' || c == '!'); +} + /* Help to copy the thing properly quoted for the shell safety. * any single quote is replaced with '\'', any exclamation point * is replaced with '\!', and the whole thing is enclosed in a @@ -16,11 +21,6 @@ int quote_path_fully = 1; * a'b ==> a'\''b ==> 'a'\''b' * a!b ==> a'\!'b ==> 'a'\!'b' */ -static inline int need_bs_quote(char c) -{ - return (c == '\'' || c == '!'); -} - void sq_quote_buf(struct strbuf *dst, const char *src) { char *to_free = NULL;