andi            Mon Nov  4 15:45:29 2002 EDT

  Modified files:              
    /TSRM       tsrm_virtual_cwd.c tsrm_virtual_cwd.h 
  Log:
  - Clean up mess made by netware guys. There's no reason not to abstract
  - the macro a tiny bit more allowing the code to look cleaner. The more
  - #ifdef's code has the more unreadable it becomes.
  
  
Index: TSRM/tsrm_virtual_cwd.c
diff -u TSRM/tsrm_virtual_cwd.c:1.37 TSRM/tsrm_virtual_cwd.c:1.38
--- TSRM/tsrm_virtual_cwd.c:1.37        Mon Nov  4 00:19:05 2002
+++ TSRM/tsrm_virtual_cwd.c     Mon Nov  4 15:45:28 2002
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: tsrm_virtual_cwd.c,v 1.37 2002/11/04 05:19:05 iliaa Exp $ */
+/* $Id: tsrm_virtual_cwd.c,v 1.38 2002/11/04 20:45:28 andi Exp $ */
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -360,12 +360,7 @@
        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 @@
                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 @@
                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: TSRM/tsrm_virtual_cwd.h
diff -u TSRM/tsrm_virtual_cwd.h:1.21 TSRM/tsrm_virtual_cwd.h:1.22
--- TSRM/tsrm_virtual_cwd.h:1.21        Mon Oct 21 19:35:28 2002
+++ TSRM/tsrm_virtual_cwd.h     Mon Nov  4 15:45:28 2002
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: tsrm_virtual_cwd.h,v 1.21 2002/10/21 23:35:28 iliaa Exp $ */
+/* $Id: tsrm_virtual_cwd.h,v 1.22 2002/11/04 20:45:28 andi Exp $ */
 
 #ifndef VIRTUAL_CWD_H
 #define VIRTUAL_CWD_H
@@ -52,7 +52,11 @@
 #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 @@
 
 
 #ifndef COPY_WHEN_ABSOLUTE
-#define COPY_WHEN_ABSOLUTE 0
+#define COPY_WHEN_ABSOLUTE(path) 0
 #endif
 
 #ifndef IS_ABSOLUTE_PATH       



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to