summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Sixt <johannes.sixt@telecom.at>2008-03-01 20:11:14 (GMT)
committerJohannes Sixt <johannes.sixt@telecom.at>2008-06-23 11:22:35 (GMT)
commit4cd148d83f852363363e921c4925e67601654ff6 (patch)
treebf28422eba86581aafd9348baf9b5fafd6282751
parent80ba074f4163dc8ee4232d64e73a8521edcadc1d (diff)
downloadgit-4cd148d83f852363363e921c4925e67601654ff6.zip
git-4cd148d83f852363363e921c4925e67601654ff6.tar.gz
git-4cd148d83f852363363e921c4925e67601654ff6.tar.bz2
setup.c: Prepare for Windows directory separators.
This turns two switch/case statements into an if-else-if cascade because we later do not want to have case '/': #ifdef __MINGW32__ case '\\': #endif but use a predicate is_dir_sep(foo) in order to check for the directory separator. Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at>
-rw-r--r--setup.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/setup.c b/setup.c
index d630e37..5fc89fd 100644
--- a/setup.c
+++ b/setup.c
@@ -26,24 +26,21 @@ static int sanitary_path_copy(char *dst, const char *src)
* (4) "../" -- strip one, eat slash and continue.
*/
if (c == '.') {
- switch (src[1]) {
- case '\0':
+ if (!src[1]) {
/* (1) */
src++;
- break;
- case '/':
+ } else if (src[1] == '/') {
/* (2) */
src += 2;
while (*src == '/')
src++;
continue;
- case '.':
- switch (src[2]) {
- case '\0':
+ } else if (src[1] == '.') {
+ if (!src[2]) {
/* (3) */
src += 2;
goto up_one;
- case '/':
+ } else if (src[2] == '/') {
/* (4) */
src += 3;
while (*src == '/')