summaryrefslogtreecommitdiff
path: root/ext/spl/php_spl.c
diff options
context:
space:
mode:
authorJani Taskinen <jani@php.net>2007-11-02 19:40:39 +0000
committerJani Taskinen <jani@php.net>2007-11-02 19:40:39 +0000
commitb48925117750da2a7fb7cff629e3852d13917f2f (patch)
tree44671e4afbcd83803757998784821a6cc19007b5 /ext/spl/php_spl.c
parent0d7479891444f46d1c30cf875037e5099f8f782b (diff)
downloadphp-git-b48925117750da2a7fb7cff629e3852d13917f2f.tar.gz
- MFH from HEAD:
. Folding tags . Parameter parsing . SPL debug info . array function improvements (not all yet) . Improvements to function calling with call_user_* functions . Improvements to debugging info in var_dump/print_r # I propably forgot already something but this all was pretty close tied # to each other so it wasn't possible to do it in parts.
Diffstat (limited to 'ext/spl/php_spl.c')
-rwxr-xr-xext/spl/php_spl.c28
1 files changed, 19 insertions, 9 deletions
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index cc88d91906..b4cd28144b 100755
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -19,7 +19,7 @@
/* $Id$ */
#ifdef HAVE_CONFIG_H
- #include "config.h"
+#include "config.h"
#endif
#include "php.h"
@@ -153,7 +153,7 @@ PHP_FUNCTION(class_implements)
/* }}} */
#define SPL_ADD_CLASS(class_name, z_list, sub, allow, ce_flags) \
- spl_add_classes(&spl_ce_ ## class_name, z_list, sub, allow, ce_flags TSRMLS_CC)
+ spl_add_classes(spl_ce_ ## class_name, z_list, sub, allow, ce_flags TSRMLS_CC)
#define SPL_LIST_CLASSES(z_list, sub, allow, ce_flags) \
SPL_ADD_CLASS(AppendIterator, z_list, sub, allow, ce_flags); \
@@ -607,26 +607,36 @@ PHP_FUNCTION(spl_autoload_functions)
PHP_FUNCTION(spl_object_hash)
{
zval *obj;
- int len;
- char *hash;
- char md5str[33];
- PHP_MD5_CTX context;
- unsigned char digest[16];
+ char* md5str;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
return;
}
+
+ md5str = emalloc(33);
+ php_spl_object_hash(obj, md5str TSRMLS_CC);
+
+ RETVAL_STRING(md5str, 0);
+}
+/* }}} */
+
+PHPAPI void php_spl_object_hash(zval *obj, char *md5str TSRMLS_DC) /* {{{*/
+{
+ int len;
+ char *hash;
+ PHP_MD5_CTX context;
+ unsigned char digest[16];
len = spprintf(&hash, 0, "%p:%d", Z_OBJ_HT_P(obj), Z_OBJ_HANDLE_P(obj));
-
+
md5str[0] = '\0';
PHP_MD5Init(&context);
PHP_MD5Update(&context, (unsigned char*)hash, len);
PHP_MD5Final(digest, &context);
make_digest(md5str, digest);
- RETVAL_STRING(md5str, 1);
efree(hash);
}
+/* }}} */
int spl_build_class_list_string(zval **entry, char **list TSRMLS_DC) /* {{{ */
{