summaryrefslogtreecommitdiff
path: root/ext/spl/spl_observer.c
diff options
context:
space:
mode:
authorMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
committerMark A. Hershberger <mah@debian.(none)>2009-03-25 00:35:13 -0400
commit0a36161e13484a99ccf69bb38f206462d27cc6d6 (patch)
treed5107db4b7369603ac7c753829e8972ee74949f7 /ext/spl/spl_observer.c
parentce7edc9b3c7370f32fec0bc7a8ec3e29ed9a5f61 (diff)
downloadphp-upstream/5.1.2.tar.gz
Imported Upstream version 5.1.2upstream/5.1.2
Diffstat (limited to 'ext/spl/spl_observer.c')
-rwxr-xr-xext/spl/spl_observer.c53
1 files changed, 43 insertions, 10 deletions
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index fae0d58ab..5f3d271cf 100755
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -2,12 +2,12 @@
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
- | Copyright (c) 1997-2005 The PHP Group |
+ | Copyright (c) 1997-2006 The PHP Group |
+----------------------------------------------------------------------+
- | This source file is SplSubject to version 3.0 of the PHP license, |
+ | This source file is SplSubject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
- | http://www.php.net/license/3_0.txt. |
+ | http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: spl_observer.c,v 1.2.2.2 2005/11/14 22:03:02 tony2001 Exp $ */
+/* $Id: spl_observer.c,v 1.2.2.5 2006/01/01 12:50:14 sniper Exp $ */
#ifdef HAVE_CONFIG_H
# include "config.h"
@@ -129,13 +129,25 @@ static zend_object_value spl_SplObjectStorage_new(zend_class_entry *class_type T
SPL_METHOD(SplObjectStorage, attach)
{
zval *obj;
+
spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
return;
}
-
- zend_hash_update(&intern->storage, (char*)&obj->value.obj, sizeof(obj->value.obj), &obj, sizeof(zval**), NULL);
+
+#if HAVE_PACKED_OBJECT_VALUE
+ zend_hash_update(&intern->storage, (char*)&Z_OBJVAL_P(obj), sizeof(zend_object_value), &obj, sizeof(zval*), NULL);
+#else
+ {
+ zend_object_value zvalue;
+ memset(&zvalue, 0, sizeof(zend_object_value));
+ zvalue.handle = Z_OBJ_HANDLE_P(obj);
+ zvalue.handlers = Z_OBJ_HT_P(obj);
+ zend_hash_update(&intern->storage, (char*)&zvalue, sizeof(zend_object_value), &obj, sizeof(zval*), NULL);
+ }
+#endif
+
obj->refcount++;
} /* }}} */
@@ -149,8 +161,19 @@ SPL_METHOD(SplObjectStorage, detach)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
return;
}
-
- zend_hash_del(&intern->storage, (char*)&obj->value.obj, sizeof(obj->value.obj));
+
+#if HAVE_PACKED_OBJECT_VALUE
+ zend_hash_del(&intern->storage, (char*)&Z_OBJVAL_P(obj), sizeof(zend_object_value));
+#else
+ {
+ zend_object_value zvalue;
+ memset(&zvalue, 0, sizeof(zend_object_value));
+ zvalue.handle = Z_OBJ_HANDLE_P(obj);
+ zvalue.handlers = Z_OBJ_HT_P(obj);
+ zend_hash_del(&intern->storage, (char*)&zvalue, sizeof(zend_object_value));
+ }
+#endif
+
zend_hash_internal_pointer_reset_ex(&intern->storage, &intern->pos);
intern->index = 0;
} /* }}} */
@@ -165,8 +188,18 @@ SPL_METHOD(SplObjectStorage, contains)
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
return;
}
-
- RETURN_BOOL(zend_hash_exists(&intern->storage, (char*)&obj->value.obj, sizeof(obj->value.obj)));
+
+#if HAVE_PACKED_OBJECT_VALUE
+ RETURN_BOOL(zend_hash_exists(&intern->storage, (char*)&Z_OBJVAL_P(obj), sizeof(zend_object_value)));
+#else
+ {
+ zend_object_value zvalue;
+ memset(&zvalue, 0, sizeof(zend_object_value));
+ zvalue.handle = Z_OBJ_HANDLE_P(obj);
+ zvalue.handlers = Z_OBJ_HT_P(obj);
+ RETURN_BOOL(zend_hash_exists(&intern->storage, (char*)&zvalue, sizeof(zend_object_value)));
+ }
+#endif
} /* }}} */
/* {{{ proto int SplObjectStorage::count()