From 1f9893d0efc35bbfc11cd310cb8ccf33117e416d Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Sat, 13 Sep 2014 14:19:39 +0200 Subject: [PATCH] avoid strlen() usage in the loop --- ext/standard/filestat.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 992f99d24e..c26170e4b6 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; -- 2.40.0