summaryrefslogtreecommitdiff
path: root/ext/spl/php_spl.c
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2014-08-21 13:54:15 +0200
committerAnatol Belski <ab@php.net>2014-08-21 13:54:15 +0200
commit7ef536e4c98ef71be0273ee6c11d5e497d9a79a3 (patch)
tree3bf9df4a55ad053bb37708c97c667ed593f169bd /ext/spl/php_spl.c
parent79b2852da4c630f9f0e5887e5bc0b8b46faac82b (diff)
parent16b4d90fa99ef656557d1cb83609dda542f36637 (diff)
downloadphp-git-7ef536e4c98ef71be0273ee6c11d5e497d9a79a3.tar.gz
Merge remote-tracking branch 'php/master'
Conflicts: Zend/zend_exceptions.c
Diffstat (limited to 'ext/spl/php_spl.c')
-rw-r--r--ext/spl/php_spl.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index a938ac05c0..5ca26d3f19 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -742,22 +742,18 @@ PHP_FUNCTION(spl_autoload_functions)
PHP_FUNCTION(spl_object_hash)
{
zval *obj;
- char hash[33];
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
return;
}
- php_spl_object_hash(obj, hash TSRMLS_CC);
-
- RETURN_STRING(hash);
+ RETURN_NEW_STR(php_spl_object_hash(obj TSRMLS_CC));
}
/* }}} */
-PHPAPI void php_spl_object_hash(zval *obj, char *result TSRMLS_DC) /* {{{*/
+PHPAPI zend_string *php_spl_object_hash(zval *obj TSRMLS_DC) /* {{{*/
{
intptr_t hash_handle, hash_handlers;
- char *hex;
if (!SPL_G(hash_mask_init)) {
if (!BG(mt_rand_is_seeded)) {
@@ -772,10 +768,7 @@ PHPAPI void php_spl_object_hash(zval *obj, char *result TSRMLS_DC) /* {{{*/
hash_handle = SPL_G(hash_mask_handle)^(intptr_t)Z_OBJ_HANDLE_P(obj);
hash_handlers = SPL_G(hash_mask_handlers)^(intptr_t)Z_OBJ_HT_P(obj);
- spprintf(&hex, 32, "%016lx%016lx", hash_handle, hash_handlers);
-
- strlcpy(result, hex, 33);
- efree(hex);
+ return strpprintf(32, "%016lx%016lx", hash_handle, hash_handlers);
}
/* }}} */