From cfd432e63d77478d913497a62827ed95c56dda73 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Sun, 18 Jun 2006 17:18:03 +0200 Subject: Remove ranges from switch statements. Though very nice and readable, the "case 'a'...'z':" construct is not ANSI C99 compliant. This patch unfolds the range in `quote.c' and substitutes the switch-statement with an if-statement in `http-fetch.c' and `http-push.c'. Signed-off-by: Florian Forster Signed-off-by: Junio C Hamano --- http-fetch.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'http-fetch.c') diff --git a/http-fetch.c b/http-fetch.c index da1a7f5416..3a2cb5e1fc 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -1136,13 +1136,14 @@ int fetch(unsigned char *sha1) static inline int needs_quote(int ch) { - switch (ch) { - case '/': case '-': case '.': - case 'A'...'Z': case 'a'...'z': case '0'...'9': + if (((ch >= 'A') && (ch <= 'Z')) + || ((ch >= 'a') && (ch <= 'z')) + || ((ch >= '0') && (ch <= '9')) + || (ch == '/') + || (ch == '-') + || (ch == '.')) return 0; - default: - return 1; - } + return 1; } static inline int hex(int v) -- cgit v1.2.1