com php-src: avoid strlen() usage in the loop: ext/standard/filestat.c
| From: | Anatol Belski | Date: | Sat, 13 Sep 2014 21:21:36 +0000 |
| Subject: | com php-src: avoid strlen() usage in the loop: ext/standard/filestat.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81561@lists.php.net to get a copy of this message | ||
Commit: 1f9893d0efc35bbfc11cd310cb8ccf33117e416d
Author: Anatol Belski <ab@php.net> Sat, 13 Sep 2014 14:19:39 +0200
Parents: ee75848b78c5337bed7166adb9a7be58a2d7fe49
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=1f9893d0efc35bbfc11cd310cb8ccf33117e416d
Log:
avoid strlen() usage in the loop
Changed paths:
M ext/standard/filestat.c
Diff:
diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c
index 992f99d..c26170e 100644
--- a/ext/standard/filestat.c
+++ b/ext/standard/filestat.c
@@ -1235,18 +1235,18 @@ PHP_FUNCTION(realpath_cache_get)
/* bucket->key is unsigned long */
if (ZEND_LONG_MAX >= bucket->key) {
- add_assoc_long(&entry, "key", bucket->key);
+ add_assoc_long_ex(&entry, "key", sizeof("key") - 1, bucket->key);
} else {
- add_assoc_double(&entry, "key", (double)bucket->key);
+ add_assoc_double_ex(&entry, "key", sizeof("key") - 1,
(double)bucket->key);
}
- add_assoc_bool(&entry, "is_dir", bucket->is_dir);
- add_assoc_stringl(&entry, "realpath", bucket->realpath,
bucket->realpath_len);
- add_assoc_long(&entry, "expires", bucket->expires);
+ add_assoc_bool_ex(&entry, "is_dir", sizeof("is_dir") - 1,
bucket->is_dir);
+ add_assoc_stringl_ex(&entry, "realpath", sizeof("realpath") - 1,
bucket->realpath, bucket->realpath_len);
+ add_assoc_long_ex(&entry, "expires", sizeof("expires") - 1,
bucket->expires);
#ifdef PHP_WIN32
- add_assoc_bool(&entry, "is_rvalid", bucket->is_rvalid);
- add_assoc_bool(&entry, "is_wvalid", bucket->is_wvalid);
- add_assoc_bool(&entry, "is_readable", bucket->is_readable);
- add_assoc_bool(&entry, "is_writable", bucket->is_writable);
+ add_assoc_bool_ex(&entry, "is_rvalid", sizeof("is_rvalid") - 1,
bucket->is_rvalid);
+ add_assoc_bool_ex(&entry, "is_wvalid", sizeof("is_wvalid") - 1,
bucket->is_wvalid);
+ add_assoc_bool_ex(&entry, "is_readable", sizeof("is_readable") - 1,
bucket->is_readable);
+ add_assoc_bool_ex(&entry, "is_writable", sizeof("is_writable") - 1,
bucket->is_writable);
#endif
zend_hash_str_update(Z_ARRVAL_P(return_value), bucket->path, bucket->path_len,
&entry);
bucket = bucket->next;