Code

quote.c: ensure the same quoting across platforms.
authorJunio C Hamano <junkio@cox.net>
Tue, 31 Oct 2006 00:07:54 +0000 (16:07 -0800)
committerJunio C Hamano <junkio@cox.net>
Tue, 31 Oct 2006 00:07:54 +0000 (16:07 -0800)
We read a byte from "char *" and compared it with ' ' to decide
if it needs quoting to protect textual output.  With a platform
where char is unsigned char that would give different result.

Signed-off-by: Junio C Hamano <junkio@cox.net>
quote.c

diff --git a/quote.c b/quote.c
index e3a4d4aef3478148ff89aebeba23e1cbf4202ba1..dc5c0a7715e4782024ede6dd90b150f6e71022ee 100644 (file)
--- a/quote.c
+++ b/quote.c
@@ -209,7 +209,7 @@ static int quote_c_style_counted(const char *name, int namelen,
                if (!ch)
                        break;
                if ((ch < ' ') || (ch == '"') || (ch == '\\') ||
-                   (ch == 0177)) {
+                   (ch >= 0177)) {
                        needquote = 1;
                        switch (ch) {
                        case '\a': EMITQ(); ch = 'a'; break;