Skip to content

Commit

Permalink
setup.c: Prepare for Windows directory separators.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Johannes Sixt committed Jun 23, 2008
1 parent 80ba074 commit 4cd148d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions setup.c
Expand Up @@ -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 == '/')
Expand Down

0 comments on commit 4cd148d

Please sign in to comment.