1999-04-08 02:10:10 +08:00
|
|
|
/*
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Zend Engine |
|
|
|
|
+----------------------------------------------------------------------+
|
2001-02-26 13:43:27 +08:00
|
|
|
| Copyright (c) 1998-2001 Zend Technologies Ltd. (http://www.zend.com) |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
2000-03-06 13:26:39 +08:00
|
|
|
| This source file is subject to version 0.92 of the Zend license, |
|
1999-07-16 22:58:16 +08:00
|
|
|
| that is bundled with this package in the file LICENSE, and is |
|
|
|
|
| available at through the world-wide-web at |
|
2000-03-06 13:26:39 +08:00
|
|
|
| http://www.zend.com/license/0_92.txt. |
|
1999-07-16 22:58:16 +08:00
|
|
|
| If you did not receive a copy of the Zend license and are unable to |
|
|
|
|
| obtain it through the world-wide-web, please send a note to |
|
|
|
|
| license@zend.com so we can mail you a copy immediately. |
|
1999-04-08 02:10:10 +08:00
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
| Authors: Andi Gutmans <andi@zend.com> |
|
|
|
|
| Zeev Suraski <zeev@zend.com> |
|
|
|
|
+----------------------------------------------------------------------+
|
|
|
|
*/
|
|
|
|
|
1999-07-16 22:58:16 +08:00
|
|
|
|
1999-09-04 03:12:07 +08:00
|
|
|
/* resource lists */
|
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
#include "zend.h"
|
|
|
|
#include "zend_list.h"
|
|
|
|
#include "zend_API.h"
|
|
|
|
#include "zend_globals.h"
|
|
|
|
|
1999-06-04 19:44:02 +08:00
|
|
|
ZEND_API int le_index_ptr;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2000-04-15 21:02:22 +08:00
|
|
|
/* true global */
|
|
|
|
static HashTable list_destructors;
|
|
|
|
|
|
|
|
|
2001-03-28 23:32:52 +08:00
|
|
|
ZEND_API int zend_list_insert(void *ptr, int type)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
int index;
|
2000-04-15 21:02:22 +08:00
|
|
|
zend_rsrc_list_entry le;
|
2001-07-27 18:10:39 +08:00
|
|
|
TSRMLS_FETCH();
|
1999-04-08 02:10:10 +08:00
|
|
|
|
|
|
|
le.ptr=ptr;
|
|
|
|
le.type=type;
|
|
|
|
le.refcount=1;
|
2001-03-28 23:22:15 +08:00
|
|
|
|
2001-03-28 23:32:52 +08:00
|
|
|
index = zend_hash_next_free_element(&EG(regular_list));
|
|
|
|
zend_hash_index_update(&EG(regular_list), index, (void *) &le, sizeof(zend_rsrc_list_entry), NULL);
|
1999-04-08 02:10:10 +08:00
|
|
|
return index;
|
|
|
|
}
|
|
|
|
|
2001-07-30 12:54:16 +08:00
|
|
|
ZEND_API int _zend_list_delete(int id TSRMLS_DC)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2000-04-15 21:02:22 +08:00
|
|
|
zend_rsrc_list_entry *le;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
|
|
|
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
|
1999-07-20 21:01:30 +08:00
|
|
|
/* printf("del(%d): %d->%d\n", id, le->refcount, le->refcount-1); */
|
1999-04-08 02:10:10 +08:00
|
|
|
if (--le->refcount<=0) {
|
|
|
|
return zend_hash_index_del(&EG(regular_list), id);
|
|
|
|
} else {
|
|
|
|
return SUCCESS;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-30 12:54:16 +08:00
|
|
|
ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2000-04-15 21:02:22 +08:00
|
|
|
zend_rsrc_list_entry *le;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2001-03-28 23:32:52 +08:00
|
|
|
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
|
1999-04-08 02:10:10 +08:00
|
|
|
*type = le->type;
|
|
|
|
return le->ptr;
|
|
|
|
} else {
|
|
|
|
*type = -1;
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-30 12:54:16 +08:00
|
|
|
ZEND_API int _zend_list_addref(int id TSRMLS_DC)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2000-04-15 21:02:22 +08:00
|
|
|
zend_rsrc_list_entry *le;
|
1999-04-08 02:10:10 +08:00
|
|
|
|
|
|
|
if (zend_hash_index_find(&EG(regular_list), id, (void **) &le)==SUCCESS) {
|
1999-07-20 21:01:30 +08:00
|
|
|
/* printf("add(%d): %d->%d\n", id, le->refcount, le->refcount+1); */
|
1999-04-08 02:10:10 +08:00
|
|
|
le->refcount++;
|
|
|
|
return SUCCESS;
|
|
|
|
} else {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-06-04 19:44:02 +08:00
|
|
|
|
1999-10-12 22:51:17 +08:00
|
|
|
ZEND_API int zend_register_resource(zval *rsrc_result, void *rsrc_pointer, int rsrc_type)
|
2000-01-16 06:52:24 +08:00
|
|
|
{
|
1999-10-12 22:51:17 +08:00
|
|
|
int rsrc_id;
|
|
|
|
|
|
|
|
rsrc_id = zend_list_insert(rsrc_pointer, rsrc_type);
|
|
|
|
|
|
|
|
if (rsrc_result) {
|
|
|
|
rsrc_result->value.lval = rsrc_id;
|
|
|
|
rsrc_result->type = IS_RESOURCE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return rsrc_id;
|
1999-09-04 03:12:07 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-30 12:54:16 +08:00
|
|
|
ZEND_API void *zend_fetch_resource(zval **passed_id TSRMLS_DC, int default_id, char *resource_type_name, int *found_resource_type, int num_resource_types, ...)
|
1999-09-04 03:12:07 +08:00
|
|
|
{
|
|
|
|
int id;
|
|
|
|
int actual_resource_type;
|
|
|
|
void *resource;
|
|
|
|
va_list resource_types;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (default_id==-1) { /* use id */
|
1999-09-18 21:07:45 +08:00
|
|
|
if (!passed_id) {
|
1999-09-24 22:03:45 +08:00
|
|
|
if (resource_type_name) {
|
1999-09-22 17:46:44 +08:00
|
|
|
zend_error(E_WARNING, "No %s resource supplied", resource_type_name);
|
1999-09-24 22:03:45 +08:00
|
|
|
}
|
1999-09-18 21:07:45 +08:00
|
|
|
return NULL;
|
1999-09-24 22:03:45 +08:00
|
|
|
} else if ((*passed_id)->type != IS_RESOURCE) {
|
|
|
|
if (resource_type_name) {
|
1999-09-22 17:46:44 +08:00
|
|
|
zend_error(E_WARNING, "Supplied argument is not a valid %s resource", resource_type_name);
|
1999-09-24 22:03:45 +08:00
|
|
|
}
|
1999-09-04 03:12:07 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
1999-09-24 22:03:45 +08:00
|
|
|
id = (*passed_id)->value.lval;
|
1999-09-04 03:12:07 +08:00
|
|
|
} else {
|
|
|
|
id = default_id;
|
|
|
|
}
|
|
|
|
|
|
|
|
resource = zend_list_find(id, &actual_resource_type);
|
|
|
|
if (!resource) {
|
2000-06-16 03:09:51 +08:00
|
|
|
if (resource_type_name) {
|
1999-09-22 17:46:44 +08:00
|
|
|
zend_error(E_WARNING, "%d is not a valid %s resource", id, resource_type_name);
|
2000-06-16 03:09:51 +08:00
|
|
|
}
|
1999-09-04 03:12:07 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
va_start(resource_types, num_resource_types);
|
|
|
|
for (i=0; i<num_resource_types; i++) {
|
|
|
|
if (actual_resource_type == va_arg(resource_types, int)) {
|
|
|
|
va_end(resource_types);
|
1999-10-12 22:51:17 +08:00
|
|
|
if (found_resource_type) {
|
|
|
|
*found_resource_type = actual_resource_type;
|
|
|
|
}
|
1999-09-04 03:12:07 +08:00
|
|
|
return resource;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
va_end(resource_types);
|
1999-10-13 20:59:48 +08:00
|
|
|
|
2000-06-16 03:09:51 +08:00
|
|
|
if (resource_type_name) {
|
1999-10-13 20:59:48 +08:00
|
|
|
zend_error(E_WARNING, "Supplied resource is not a valid %s resource", resource_type_name);
|
2000-06-16 03:09:51 +08:00
|
|
|
}
|
1999-10-13 20:59:48 +08:00
|
|
|
|
1999-09-04 03:12:07 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-18 01:33:37 +08:00
|
|
|
void list_entry_destructor(void *ptr)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2000-04-15 21:02:22 +08:00
|
|
|
zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
|
|
|
|
zend_rsrc_list_dtors_entry *ld;
|
2001-07-31 13:32:25 +08:00
|
|
|
TSRMLS_FETCH();
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2000-04-15 21:02:22 +08:00
|
|
|
if (zend_hash_index_find(&list_destructors, le->type,(void **) &ld)==SUCCESS) {
|
|
|
|
switch (ld->type) {
|
|
|
|
case ZEND_RESOURCE_LIST_TYPE_STD:
|
|
|
|
if (ld->list_dtor) {
|
|
|
|
(ld->list_dtor)(le->ptr);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ZEND_RESOURCE_LIST_TYPE_EX:
|
|
|
|
if (ld->list_dtor_ex) {
|
2001-07-31 13:32:25 +08:00
|
|
|
ld->list_dtor_ex(le TSRMLS_CC);
|
2000-04-15 21:02:22 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
EMPTY_SWITCH_DEFAULT_CASE()
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
zend_error(E_WARNING,"Unknown list entry type in request shutdown (%d)",le->type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-01-18 01:33:37 +08:00
|
|
|
void plist_entry_destructor(void *ptr)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2000-04-15 21:02:22 +08:00
|
|
|
zend_rsrc_list_entry *le = (zend_rsrc_list_entry *) ptr;
|
|
|
|
zend_rsrc_list_dtors_entry *ld;
|
2001-07-31 13:32:25 +08:00
|
|
|
TSRMLS_FETCH();
|
1999-04-08 02:10:10 +08:00
|
|
|
|
2000-04-15 21:02:22 +08:00
|
|
|
if (zend_hash_index_find(&list_destructors, le->type,(void **) &ld)==SUCCESS) {
|
2001-01-04 14:20:26 +08:00
|
|
|
switch (ld->type) {
|
|
|
|
case ZEND_RESOURCE_LIST_TYPE_STD:
|
2001-01-17 07:49:16 +08:00
|
|
|
if (ld->plist_dtor) {
|
|
|
|
(ld->plist_dtor)(le->ptr);
|
2001-01-04 14:20:26 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
case ZEND_RESOURCE_LIST_TYPE_EX:
|
2001-01-17 07:49:16 +08:00
|
|
|
if (ld->plist_dtor_ex) {
|
2001-07-31 13:32:25 +08:00
|
|
|
ld->plist_dtor_ex(le TSRMLS_CC);
|
2001-01-04 14:20:26 +08:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
EMPTY_SWITCH_DEFAULT_CASE()
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
zend_error(E_WARNING,"Unknown persistent list entry type in module shutdown (%d)",le->type);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-27 18:10:39 +08:00
|
|
|
int zend_init_rsrc_list(TSRMLS_D)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2001-03-28 23:22:15 +08:00
|
|
|
if (zend_hash_init(&EG(regular_list), 0, NULL, list_entry_destructor, 0)==SUCCESS) {
|
|
|
|
EG(regular_list).nNextFreeElement=1; /* we don't want resource id 0 */
|
2001-03-29 00:12:16 +08:00
|
|
|
return SUCCESS;
|
|
|
|
} else {
|
|
|
|
return FAILURE;
|
2001-03-28 23:22:15 +08:00
|
|
|
}
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-27 18:10:39 +08:00
|
|
|
int zend_init_rsrc_plist(TSRMLS_D)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2000-07-11 22:47:34 +08:00
|
|
|
return zend_hash_init_ex(&EG(persistent_list), 0, NULL, plist_entry_destructor, 1, 0);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-27 18:10:39 +08:00
|
|
|
void zend_destroy_rsrc_list(TSRMLS_D)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2001-07-20 22:20:34 +08:00
|
|
|
Bucket *p, *q;
|
|
|
|
HashTable *ht = &EG(regular_list);
|
|
|
|
|
|
|
|
while (1) {
|
|
|
|
p = ht->pListTail;
|
|
|
|
if (!p) {
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
q = p->pListLast;
|
|
|
|
if (q) {
|
|
|
|
q->pListNext = NULL;
|
|
|
|
}
|
|
|
|
ht->pListTail = q;
|
|
|
|
|
|
|
|
if (ht->pDestructor) {
|
2001-07-21 22:25:27 +08:00
|
|
|
zend_try {
|
2001-07-20 22:20:34 +08:00
|
|
|
ht->pDestructor(p->pData);
|
2001-07-21 22:25:27 +08:00
|
|
|
} zend_end_try();
|
2001-07-20 22:20:34 +08:00
|
|
|
}
|
|
|
|
if (!p->pDataPtr && p->pData) {
|
|
|
|
pefree(p->pData, ht->persistent);
|
|
|
|
}
|
|
|
|
pefree(p, ht->persistent);
|
|
|
|
}
|
|
|
|
pefree(ht->arBuckets, ht->persistent);
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-20 22:20:34 +08:00
|
|
|
|
2001-07-27 18:10:39 +08:00
|
|
|
void zend_destroy_rsrc_plist(TSRMLS_D)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
2001-07-13 20:05:47 +08:00
|
|
|
zend_hash_reverse_destroy(&EG(persistent_list));
|
1999-04-08 02:10:10 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-31 12:53:54 +08:00
|
|
|
static int clean_module_resource(zend_rsrc_list_entry *le, int *resource_id TSRMLS_DC)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
if (le->type == *resource_id) {
|
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-31 12:53:54 +08:00
|
|
|
static int zend_clean_module_rsrc_dtors_cb(zend_rsrc_list_dtors_entry *ld, int *module_number TSRMLS_DC)
|
1999-04-08 02:10:10 +08:00
|
|
|
{
|
|
|
|
if (ld->module_number == *module_number) {
|
2001-07-31 12:53:54 +08:00
|
|
|
zend_hash_apply_with_argument(&EG(regular_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
|
|
|
|
zend_hash_apply_with_argument(&EG(persistent_list), (apply_func_arg_t) clean_module_resource, (void *) &(ld->resource_id) TSRMLS_CC);
|
1999-04-08 02:10:10 +08:00
|
|
|
return 1;
|
|
|
|
} else {
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-31 12:53:54 +08:00
|
|
|
void zend_clean_module_rsrc_dtors(int module_number TSRMLS_DC)
|
2000-04-15 21:02:22 +08:00
|
|
|
{
|
2001-07-31 12:53:54 +08:00
|
|
|
zend_hash_apply_with_argument(&list_destructors, (apply_func_arg_t) zend_clean_module_rsrc_dtors_cb, (void *) &module_number TSRMLS_CC);
|
2000-04-15 21:02:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
ZEND_API int zend_register_list_destructors(void (*ld)(void *), void (*pld)(void *), int module_number)
|
|
|
|
{
|
|
|
|
zend_rsrc_list_dtors_entry lde;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
lde.list_dtor=(void (*)(void *)) ld;
|
|
|
|
lde.plist_dtor=(void (*)(void *)) pld;
|
|
|
|
lde.list_dtor_ex = lde.plist_dtor_ex = NULL;
|
|
|
|
lde.module_number = module_number;
|
|
|
|
lde.resource_id = list_destructors.nNextFreeElement;
|
|
|
|
lde.type = ZEND_RESOURCE_LIST_TYPE_STD;
|
2000-07-15 04:00:24 +08:00
|
|
|
lde.type_name = NULL;
|
2000-04-15 21:02:22 +08:00
|
|
|
|
|
|
|
if (zend_hash_next_index_insert(&list_destructors, (void *) &lde, sizeof(zend_rsrc_list_dtors_entry), NULL)==FAILURE) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
return list_destructors.nNextFreeElement-1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-07-15 04:00:24 +08:00
|
|
|
ZEND_API int zend_register_list_destructors_ex(rsrc_dtor_func_t ld, rsrc_dtor_func_t pld, char *type_name, int module_number)
|
2000-04-15 21:02:22 +08:00
|
|
|
{
|
|
|
|
zend_rsrc_list_dtors_entry lde;
|
|
|
|
|
|
|
|
#if 0
|
|
|
|
printf("Registering destructors %d for module %d\n", list_destructors.nNextFreeElement, module_number);
|
|
|
|
#endif
|
|
|
|
|
|
|
|
lde.list_dtor = NULL;
|
|
|
|
lde.plist_dtor = NULL;
|
|
|
|
lde.list_dtor_ex = ld;
|
|
|
|
lde.plist_dtor_ex = pld;
|
|
|
|
lde.module_number = module_number;
|
|
|
|
lde.resource_id = list_destructors.nNextFreeElement;
|
|
|
|
lde.type = ZEND_RESOURCE_LIST_TYPE_EX;
|
2000-07-15 04:00:24 +08:00
|
|
|
lde.type_name = type_name;
|
2000-04-15 21:02:22 +08:00
|
|
|
|
|
|
|
if (zend_hash_next_index_insert(&list_destructors,(void *) &lde, sizeof(zend_rsrc_list_dtors_entry),NULL)==FAILURE) {
|
|
|
|
return FAILURE;
|
|
|
|
}
|
|
|
|
return list_destructors.nNextFreeElement-1;
|
|
|
|
}
|
|
|
|
|
2001-05-21 01:06:39 +08:00
|
|
|
ZEND_API int zend_fetch_list_dtor_id(char *type_name)
|
|
|
|
{
|
|
|
|
zend_rsrc_list_dtors_entry *lde;
|
|
|
|
HashPosition pos;
|
|
|
|
|
|
|
|
zend_hash_internal_pointer_reset_ex(&list_destructors, &pos);
|
|
|
|
while(zend_hash_get_current_data_ex(&list_destructors, (void **)&lde, &pos) == SUCCESS) {
|
2001-05-21 04:25:20 +08:00
|
|
|
if(strcmp(type_name, lde->type_name) == 0) {
|
2001-05-21 01:06:39 +08:00
|
|
|
#if 0
|
|
|
|
printf("Found resource id %d for resource type %s\n",(*lde).resource_id,type_name);
|
|
|
|
#endif
|
|
|
|
return lde->resource_id;
|
|
|
|
}
|
|
|
|
zend_hash_move_forward_ex(&list_destructors, &pos);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2000-04-15 21:02:22 +08:00
|
|
|
|
2001-01-24 01:55:17 +08:00
|
|
|
int zend_init_rsrc_list_dtors(void)
|
2000-04-15 21:02:22 +08:00
|
|
|
{
|
2001-05-21 00:04:22 +08:00
|
|
|
int retval;
|
|
|
|
|
|
|
|
retval = zend_hash_init(&list_destructors, 50, NULL, NULL, 1);
|
|
|
|
list_destructors.nNextFreeElement=1; /* we don't want resource type 0 */
|
|
|
|
|
|
|
|
return retval;
|
2000-04-15 21:02:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-01-24 01:55:17 +08:00
|
|
|
void zend_destroy_rsrc_list_dtors(void)
|
2000-04-15 21:02:22 +08:00
|
|
|
{
|
|
|
|
zend_hash_destroy(&list_destructors);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-07-30 12:54:16 +08:00
|
|
|
char *zend_rsrc_list_get_rsrc_type(int resource TSRMLS_DC)
|
2000-07-15 04:00:24 +08:00
|
|
|
{
|
|
|
|
zend_rsrc_list_dtors_entry *lde;
|
2000-10-21 02:26:15 +08:00
|
|
|
int rsrc_type;
|
2000-07-15 04:00:24 +08:00
|
|
|
|
2000-10-21 02:26:15 +08:00
|
|
|
if (!zend_list_find(resource, &rsrc_type))
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
if (zend_hash_index_find(&list_destructors, rsrc_type, (void **) &lde)==SUCCESS) {
|
2000-07-15 04:00:24 +08:00
|
|
|
return lde->type_name;
|
|
|
|
} else {
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
1999-04-08 02:10:10 +08:00
|
|
|
/*
|
|
|
|
* Local variables:
|
|
|
|
* tab-width: 4
|
|
|
|
* c-basic-offset: 4
|
|
|
|
* End:
|
|
|
|
*/
|