com php-src: avoid multiple strlen() usage: main/fopen_wrappe rs.c
| From: | Anatol Belski | Date: | Sat, 13 Sep 2014 21:21:42 +0000 |
| Subject: | com php-src: avoid multiple strlen() usage: main/fopen_wrappe rs.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81556@lists.php.net to get a copy of this message | ||
Commit: d6bf1117a6d21ec04ce1400bed2293129369b71b
Author: Anatol Belski <ab@php.net> Sat, 13 Sep 2014 18:09:30 +0200
Parents: 586b863ba754a19495f4abaadd32df85a394616d
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d6bf1117a6d21ec04ce1400bed2293129369b71b
Log:
avoid multiple strlen() usage
Changed paths:
M main/fopen_wrappers.c
Diff:
diff --git a/main/fopen_wrappers.c b/main/fopen_wrappers.c
index b0eec9a..7afa04c 100644
--- a/main/fopen_wrappers.c
+++ b/main/fopen_wrappers.c
@@ -226,12 +226,13 @@ PHPAPI int php_check_specific_open_basedir(const char *basedir, const char
*path
/* Resolve open_basedir to resolved_basedir */
if (expand_filepath(local_open_basedir, resolved_basedir TSRMLS_CC) != NULL) {
+ int basedir_len = (int)strlen(basedir);
/* Handler for basedirs that end with a / */
- resolved_basedir_len = strlen(resolved_basedir);
+ resolved_basedir_len = (int)strlen(resolved_basedir);
#if defined(PHP_WIN32) || defined(NETWARE)
- if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR || basedir[strlen(basedir) - 1] ==
'/') {
+ if (basedir[basedir_len - 1] == PHP_DIR_SEPARATOR || basedir[basedir_len - 1] == '/') {
#else
- if (basedir[strlen(basedir) - 1] == PHP_DIR_SEPARATOR) {
+ if (basedir[basedir_len - 1] == PHP_DIR_SEPARATOR) {
#endif
if (resolved_basedir[resolved_basedir_len - 1] != PHP_DIR_SEPARATOR) {
resolved_basedir[resolved_basedir_len] = PHP_DIR_SEPARATOR;
@@ -758,7 +759,7 @@ PHPAPI char *expand_filepath_with_mode(const char *filepath, char *real_path, co
cwd_state new_state;
char cwd[MAXPATHLEN];
int copy_len;
- int path_len = strlen(filepath);
+ int path_len = (int)strlen(filepath);
if (!filepath[0]) {
return NULL;