@matheusbsbs / matheus-bagliano / commits / 50e7b06730
Fork 0

[PATCH] quote.c: Make loop control more readable.

quote_c_style_counted() in quote.c uses a hard-to-read construct. Convert this to a more traditional form of the for loop. Signed-off-by: Pavel Roskin <proski@gnu.org> Signed-off-by: Junio C Hamano <junkio@cox.net>

Pavel Roskin committed Dec 21, 2005 at 15:35 UTC 50e7b06730915dd7439e880fe84439a4483ccbb4
1 file changed +4 -2
quote.c
+4 -2
@@ -126,8 +126,10 @@ static int quote_c_style_counted(const char *name, int namelen,
126
127 if (!no_dq)
128 EMIT('"');
129 - for (sp = name; (ch = *sp++) && (sp - name) <= namelen; ) {
130 -
129 + for (sp = name; sp < name + namelen; sp++) {
130 + ch = *sp;
131 + if (!ch)
132 + break;
133 if ((ch < ' ') || (ch == '"') || (ch == '\\') ||
134 (ch == 0177)) {
135 needquote = 1;