on the target platform.
PS_MOD(files)
};
-#ifdef PHP_WIN32
-#define DIR_DELIMITER '\\'
-#else
-#define DIR_DELIMITER '/'
-#endif
-
static int _ps_files_valid_key(const char *key)
{
size_t len;
(strlen(data->basedir) + 2 * data->dirdepth + keylen + 5 + sizeof(FILE_PREFIX)))
return NULL;
p = key;
- n = sprintf(buf, "%s%c", data->basedir, DIR_DELIMITER);
+ n = sprintf(buf, "%s%c", data->basedir, PHP_SEPARATOR);
for (i = 0; i < data->dirdepth; i++) {
buf[n++] = *p++;
- buf[n++] = DIR_DELIMITER;
+ buf[n++] = PHP_SEPARATOR;
}
buf[n] = '\0';
strcat(buf, FILE_PREFIX);
/* does the file start with our prefix? */
if (!strncmp(entry->d_name, FILE_PREFIX, sizeof(FILE_PREFIX) - 1) &&
/* create full path */
- snprintf(buf, MAXPATHLEN, "%s%c%s", dirname, DIR_DELIMITER,
+ snprintf(buf, MAXPATHLEN, "%s%c%s", dirname, PHP_SEPARATOR,
entry->d_name) > 0 &&
/* stat the directory entry */
V_STAT(buf, &sbuf) == 0 &&
* a joint header file when we move virtual_cwd to TSRM */
#ifdef ZEND_WIN32
#define IS_SLASH(c) ((c) == '/' || (c) == '\\')
-#define DEFAULT_SLASH '\\'
#else
#define IS_SLASH(c) ((c) == '/')
-#define DEFAULT_SLASH '/'
#endif
if (pw && pw->pw_dir) {
filename = emalloc(strlen(PG(user_dir)) + strlen(path_info) + strlen(pw->pw_dir) + 4);
if (filename) {
- sprintf(filename, "%s%c%s%c%s", pw->pw_dir, DEFAULT_SLASH,
- PG(user_dir), DEFAULT_SLASH, s+1); /* Safe */
+ sprintf(filename, "%s%c%s%c%s", pw->pw_dir, PHP_SEPARATOR,
+ PG(user_dir), PHP_SEPARATOR, s+1); /* Safe */
STR_FREE(SG(request_info).path_translated);
SG(request_info).path_translated = filename;
}
if (filename) {
memcpy(filename, PG(doc_root), length);
if (!IS_SLASH(filename[length - 1])) { /* length is never 0 */
- filename[length++] = DEFAULT_SLASH;
+ filename[length++] = PHP_SEPARATOR;
}
if (IS_SLASH(path_info[0])) {
length--;
# else
# define PHPAPI __declspec(dllimport)
# endif
+#define PHP_SEPARATOR '\\'
#else
#define PHPAPI
#define THREAD_LS
+#define PHP_SEPARATOR '/'
#endif
#include "php_regex.h"