summaryrefslogtreecommitdiff
path: root/TSRM
diff options
context:
space:
mode:
authorAndi Gutmans <andi@php.net>2002-11-04 20:45:28 +0000
committerAndi Gutmans <andi@php.net>2002-11-04 20:45:28 +0000
commit7dd124803cfbc92b40aa3fb11093e9f7bd4f951e (patch)
tree0b73a4ab683825f48586f1a9585199709f7b0f9f /TSRM
parente66a760f6bb9d95aaddef09cbdfdd7927d20afa1 (diff)
downloadphp-git-7dd124803cfbc92b40aa3fb11093e9f7bd4f951e.tar.gz
- 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.
Diffstat (limited to 'TSRM')
-rw-r--r--TSRM/tsrm_virtual_cwd.c15
-rw-r--r--TSRM/tsrm_virtual_cwd.h8
2 files changed, 6 insertions, 17 deletions
diff --git a/TSRM/tsrm_virtual_cwd.c b/TSRM/tsrm_virtual_cwd.c
index 37cb560f6b..01e1fe9eda 100644
--- a/TSRM/tsrm_virtual_cwd.c
+++ b/TSRM/tsrm_virtual_cwd.c
@@ -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);
diff --git a/TSRM/tsrm_virtual_cwd.h b/TSRM/tsrm_virtual_cwd.h
index 025ec0a7a8..6d2a51e466 100644
--- a/TSRM/tsrm_virtual_cwd.h
+++ b/TSRM/tsrm_virtual_cwd.h
@@ -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