X-Git-Url: https://git.octo.it/?p=git.git;a=blobdiff_plain;f=quote.c;h=06792d47c3e324ee9893a4e52035f0642f38005f;hp=76eb14426581f03d0b15ee4eb720456a0729d1bc;hb=HEAD;hpb=9ef2b3cbf62d15aa0312bde349347873d7c0f399 diff --git a/quote.c b/quote.c index 76eb1442..06792d47 100644 --- a/quote.c +++ b/quote.c @@ -126,8 +126,10 @@ static int quote_c_style_counted(const char *name, int namelen, if (!no_dq) EMIT('"'); - for (sp = name; (ch = *sp++) && (sp - name) <= namelen; ) { - + for (sp = name; sp < name + namelen; sp++) { + ch = *sp; + if (!ch) + break; if ((ch < ' ') || (ch == '"') || (ch == '\\') || (ch == 0177)) { needquote = 1; @@ -142,8 +144,6 @@ static int quote_c_style_counted(const char *name, int namelen, case '\\': /* fallthru */ case '"': EMITQ(); break; - case ' ': - break; default: /* octal */ EMITQ();