]> granicus.if.org Git - php/commitdiff
- Clean up mess made by netware guys. There's no reason not to abstract
authorAndi Gutmans <andi@php.net>
Mon, 4 Nov 2002 20:45:28 +0000 (20:45 +0000)
committerAndi Gutmans <andi@php.net>
Mon, 4 Nov 2002 20:45:28 +0000 (20:45 +0000)
- the macro a tiny bit more allowing the code to look cleaner. The more
- #ifdef's code has the more unreadable it becomes.

TSRM/tsrm_virtual_cwd.c
TSRM/tsrm_virtual_cwd.h

index 37cb560f6b056ea906a611a2221b9ac780e4fca9..01e1fe9eda52e58365d1b28a5406b4d1a3239f5f 100644 (file)
@@ -360,12 +360,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
        fprintf(stderr,"cwd = %s path = %s\n", state->cwd, path);
 #endif
        if (IS_ABSOLUTE_PATH(path_copy, path_length)) {
-/* COPY_WHEN_ABSOLUTE needs to account for volume name that is unique to NetWare absolute paths */
-#ifndef NETWARE
-               copy_amount = COPY_WHEN_ABSOLUTE;
-#else
         copy_amount = COPY_WHEN_ABSOLUTE(path_copy);
-#endif
                is_absolute = 1;
 #ifdef TSRM_WIN32
        } else if (IS_UNC_PATH(path_copy, path_length)) {
@@ -438,12 +433,7 @@ CWD_API int virtual_file_ex(cwd_state *state, const char *path, verify_path_func
                ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok);
        }
 
-/* COPY_WHEN_ABSOLUTE needs to account for volume name that is unique to NetWare absolute paths */
-#ifndef NETWARE
-       if (state->cwd_length == COPY_WHEN_ABSOLUTE) {
-#else
        if (state->cwd_length == COPY_WHEN_ABSOLUTE(state->cwd)) {
-#endif
                state->cwd = (char *) realloc(state->cwd, state->cwd_length+1+1);
                state->cwd[state->cwd_length] = DEFAULT_SLASH;
                state->cwd[state->cwd_length+1] = '\0';
@@ -493,12 +483,7 @@ CWD_API int virtual_chdir_file(const char *path, int (*p_chdir)(const char *path
                return -1;
        }
 
-/* COPY_WHEN_ABSOLUTE needs to account for volume name that is unique to NetWare absolute paths */
-#ifndef NETWARE
-       if (length == COPY_WHEN_ABSOLUTE && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
-#else
        if (length == COPY_WHEN_ABSOLUTE(path) && IS_ABSOLUTE_PATH(path, length+1)) { /* Also use trailing slash if this is absolute */
-#endif
                length++;
        }
        temp = (char *) tsrm_do_alloca(length+1);
index 025ec0a7a84824382828a5f4ed89c6c8ef3645bc..6d2a51e4661360315dc2d5cb5dc847699f8be02d 100644 (file)
@@ -52,7 +52,11 @@ typedef unsigned short mode_t;
 #define IS_SLASH(c)    ((c) == '/' || (c) == '\\')
 #define IS_SLASH_P(c)  (*(c) == '/' || \
         (*(c) == '\\' && !IsDBCSLeadByte(*(c-1))))
-#define COPY_WHEN_ABSOLUTE 2
+
+/* COPY_WHEN_ABSOLUTE also takes path as argument because netware needs it
+/* to account for volume name that is unique to NetWare absolute paths
+ */
+#define COPY_WHEN_ABSOLUTE(path) 2
 #define IS_ABSOLUTE_PATH(path, len) \
        (len >= 2 && isalpha(path[0]) && path[1] == ':')
 #define IS_UNC_PATH(path, len) \
@@ -91,7 +95,7 @@ typedef unsigned short mode_t;
 
 
 #ifndef COPY_WHEN_ABSOLUTE
-#define COPY_WHEN_ABSOLUTE 0
+#define COPY_WHEN_ABSOLUTE(path) 0
 #endif
 
 #ifndef IS_ABSOLUTE_PATH