Code

setup.c: Prepare for Windows directory separators.
authorJohannes Sixt <johannes.sixt@telecom.at>
Sat, 1 Mar 2008 20:11:14 +0000 (21:11 +0100)
committerJohannes Sixt <johannes.sixt@telecom.at>
Mon, 23 Jun 2008 11:22:35 +0000 (13:22 +0200)
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>
setup.c

diff --git a/setup.c b/setup.c
index d630e374e7c03b934de14adceb93c9c327796e6d..5fc89fd7da6a7035e7c187e17074073b8d51e6a7 100644 (file)
--- 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 == '/')