@matheusbsbs / matheus-bagliano / commits / 4cd148d83f
Fork 0

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>

Johannes Sixt committed Mar 1, 2008 at 21:11 UTC 4cd148d83f852363363e921c4925e67601654ff6
1 file changed +5 -8
setup.c
+5 -8
@@ -26,24 +26,21 @@ static int sanitary_path_copy(char *dst, const char *src)
26 * (4) "../" -- strip one, eat slash and continue.
27 */
28 if (c == '.') {
29 - switch (src[1]) {
30 - case '\0':
29 + if (!src[1]) {
30 /* (1) */
31 src++;
33 - break;
34 - case '/':
32 + } else if (src[1] == '/') {
33 /* (2) */
34 src += 2;
35 while (*src == '/')
36 src++;
37 continue;
40 - case '.':
41 - switch (src[2]) {
42 - case '\0':
38 + } else if (src[1] == '.') {
39 + if (!src[2]) {
40 /* (3) */
41 src += 2;
42 goto up_one;
46 - case '/':
43 + } else if (src[2] == '/') {
44 /* (4) */
45 src += 3;
46 while (*src == '/')