diff options
author | Anatol Belski <ab@php.net> | 2014-09-14 12:59:31 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-09-14 12:59:31 +0200 |
commit | b6b376efe538997369efc3dfffede295f433105d (patch) | |
tree | c77d5e90728e132f85b83e0b0ad2c1ecac2d0d8c /ext/zip/php_zip.c | |
parent | f1ba5389cd0e13da2230dd411c6151dedde88552 (diff) | |
download | php-git-b6b376efe538997369efc3dfffede295f433105d.tar.gz |
avoid repeated strlen() usage
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index 5f98a639e1..0f6a6bfe88 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -1609,9 +1609,11 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /* RETURN_FALSE; } - if (remove_path && remove_path_len > 1 && (remove_path[strlen(remove_path) - 1] == '/' || - remove_path[strlen(remove_path) - 1] == '\\')) { - remove_path[strlen(remove_path) - 1] = '\0'; + if (remove_path && remove_path_len > 1) { + int tmp_idx = (int)strlen(remove_path) - 1; + if (remove_path[tmp_idx] == '/' || remove_path[tmp_idx] == '\\') { + remove_path[tmp_idx] = '\0'; + } } if (type == 1) { |