From: Pierre Joye Date: Sun, 11 Oct 2009 20:50:53 +0000 (+0000) Subject: - #48779, don't loop twice over the path chars X-Git-Tag: php-5.4.0alpha1~191^2~2523 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d1a85d20a45ada7bd3b6acefadec336170699dd7;p=php - #48779, don't loop twice over the path chars --- diff --git a/main/php_ini.c b/main/php_ini.c index 83a1b801d4..7f951a0681 100644 --- a/main/php_ini.c +++ b/main/php_ini.c @@ -42,16 +42,17 @@ #endif #ifdef PHP_WIN32 -#define TRANSLATE_SLASHES(path) \ +#define TRANSLATE_SLASHES_LOWER(path) \ { \ char *tmp = path; \ while (*tmp) { \ if (*tmp == '\\') *tmp = '/'; \ - tmp++; \ + else *tmp = (__isascii(*tmp)) ? _tolower(*tmp) : tolower(*tmp); \ + tmp++; \ } \ } #else -#define TRANSLATE_SLASHES(path) +#define TRANSLATE_SLASHES_LOWER(path) #endif @@ -287,12 +288,9 @@ static void php_ini_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callback_t key_len = Z_STRLEN_P(arg1) - sizeof("PATH") + 1; is_special_section = 1; has_per_dir_config = 1; -#ifdef PHP_WIN32 - /* make the path lowercase on Windows, for case insensitivty. */ - strlwr(key); - TRANSLATE_SLASHES(key); -#endif + /* make the path lowercase on Windows, for case insensitivty. Does nothign for other platforms */ + TRANSLATE_SLASHES_LOWER(key); /* HOST sections */ } else if (!strncasecmp(Z_STRVAL_P(arg1), "HOST", sizeof("HOST") - 1)) {