summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 64e86c5)
raw | patch | inline | side by side (parent: 64e86c5)
author | Florian Forster <octo@verplant.org> | |
Sun, 18 Jun 2006 15:18:03 +0000 (17:18 +0200) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Mon, 19 Jun 2006 04:19:09 +0000 (21:19 -0700) |
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 <octo@verplant.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
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 <octo@verplant.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
http-fetch.c | patch | blob | history | |
http-push.c | patch | blob | history | |
quote.c | patch | blob | history |
diff --git a/http-fetch.c b/http-fetch.c
index da1a7f5416a4bf3a633d3577382984f528694a78..3a2cb5e1fc1b2794f632c5ddbedfa99500081e5a 100644 (file)
--- a/http-fetch.c
+++ b/http-fetch.c
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)
diff --git a/http-push.c b/http-push.c
index ba64f8fff58936ab59074b835b9df06eecf3031e..aaf155c5bcb5b7587afa1a3063316d3183020984 100644 (file)
--- a/http-push.c
+++ b/http-push.c
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)
index 06792d47c3e324ee9893a4e52035f0642f38005f..dcc23266109ce30e3fd098f3c76799b67b75a332 100644 (file)
--- a/quote.c
+++ b/quote.c
case '\\': case '"':
break; /* verbatim */
- case '0'...'7':
+ case '0':
+ case '1':
+ case '2':
+ case '3':
+ case '4':
+ case '5':
+ case '6':
+ case '7':
/* octal */
ac = ((ch - '0') << 6);
if ((ch = *sp++) < '0' || '7' < ch)