cvs: ZendEngine2 / zend_objects_API.c zend_objects_API.h
| From: | Andrei Zmievski | Date: | Fri, 21 Apr 2006 16:36:38 +0000 |
| Subject: | cvs: ZendEngine2 / zend_objects_API.c zend_objects_API.h | ||
| Groups: | php.zend-engine.cvs | ||
| Request: | Send a blank email to php-zend-engine-cvs+get-4826@lists.php.net to get a copy of this message | ||
andrei Fri Apr 21 16:36:38 2006 UTC
Modified files:
/ZendEngine2 zend_objects_API.c zend_objects_API.h
Log:
Add:
* zend_objects_store_add_ref_by_handle()
* zend_objects_store_del_ref_by_handle()
* zend_objects_store_get_object_by_handle()
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_objects_API.c?r1=1.56&r2=1.57&diff_format=u
Index: ZendEngine2/zend_objects_API.c
diff -u ZendEngine2/zend_objects_API.c:1.56 ZendEngine2/zend_objects_API.c:1.57
--- ZendEngine2/zend_objects_API.c:1.56 Tue Mar 28 21:58:21 2006
+++ ZendEngine2/zend_objects_API.c Fri Apr 21 16:36:38 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_objects_API.c,v 1.56 2006/03/28 21:58:21 tony2001 Exp $ */
+/* $Id: zend_objects_API.c,v 1.57 2006/04/21 16:36:38 andrei Exp $ */
#include "zend.h"
#include "zend_globals.h"
@@ -135,6 +135,11 @@
#endif
}
+ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC)
+{
+ EG(objects_store).object_buckets[handle].bucket.obj.refcount++;
+}
+
#define ZEND_OBJECTS_STORE_ADD_TO_FREE_LIST() \
EG(objects_store).object_buckets[handle].bucket.free_list.next =
EG(objects_store).free_list_head; \
EG(objects_store).free_list_head = handle; \
@@ -143,28 +148,35 @@
ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
{
zend_object_handle handle;
+
+ handle = Z_OBJ_HANDLE_P(zobject);
+
+ zobject->refcount++;
+ zend_objects_store_del_ref_by_handle(handle TSRMLS_CC);
+ zobject->refcount--;
+}
+
+ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC)
+{
struct _store_object *obj;
if (!EG(objects_store).object_buckets) {
return;
}
- handle = Z_OBJ_HANDLE_P(zobject);
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
/* Make sure we hold a reference count during the destructor call
otherwise, when the destructor ends the storage might be freed
when the refcount reaches 0 a second time
- */
+ */
if (EG(objects_store).object_buckets[handle].valid) {
if (obj->refcount == 1) {
if (!EG(objects_store).object_buckets[handle].destructor_called) {
EG(objects_store).object_buckets[handle].destructor_called = 1;
if (obj->dtor) {
- zobject->refcount++;
obj->dtor(obj->object, handle TSRMLS_CC);
- zobject->refcount--;
}
}
if (obj->refcount == 1) {
@@ -215,6 +227,11 @@
return EG(objects_store).object_buckets[handle].bucket.obj.object;
}
+ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC)
+{
+ return EG(objects_store).object_buckets[handle].bucket.obj.object;
+}
+
/* zend_object_store_set_object:
* It is ONLY valid to call this function from within the constructor of an
* overloaded object. Its purpose is to set the object pointer for the object
http://cvs.php.net/viewcvs.cgi/ZendEngine2/zend_objects_API.h?r1=1.22&r2=1.23&diff_format=u
Index: ZendEngine2/zend_objects_API.h
diff -u ZendEngine2/zend_objects_API.h:1.22 ZendEngine2/zend_objects_API.h:1.23
--- ZendEngine2/zend_objects_API.h:1.22 Tue Feb 21 08:00:39 2006
+++ ZendEngine2/zend_objects_API.h Fri Apr 21 16:36:38 2006
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: zend_objects_API.h,v 1.22 2006/02/21 08:00:39 dmitry Exp $ */
+/* $Id: zend_objects_API.h,v 1.23 2006/04/21 16:36:38 andrei Exp $ */
#ifndef ZEND_OBJECTS_API_H
#define ZEND_OBJECTS_API_H
@@ -64,8 +64,11 @@
ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC);
ZEND_API void zend_objects_store_del_ref(zval *object TSRMLS_DC);
+ZEND_API void zend_objects_store_add_ref_by_handle(zend_object_handle handle TSRMLS_DC);
+ZEND_API void zend_objects_store_del_ref_by_handle(zend_object_handle handle TSRMLS_DC);
ZEND_API zend_object_value zend_objects_store_clone_obj(zval *object TSRMLS_DC);
ZEND_API void *zend_object_store_get_object(zval *object TSRMLS_DC);
+ZEND_API void *zend_object_store_get_object_by_handle(zend_object_handle handle TSRMLS_DC);
/* See comment in zend_objects_API.c before you use this */
ZEND_API void zend_object_store_set_object(zval *zobject, void *object TSRMLS_DC);
ZEND_API void zend_object_store_ctor_failed(zval *zobject TSRMLS_DC);