summaryrefslogtreecommitdiff
path: root/Zend/zend_list.c
diff options
context:
space:
mode:
authorSterling Hughes <sterling@php.net>2003-04-02 16:58:52 +0000
committerSterling Hughes <sterling@php.net>2003-04-02 16:58:52 +0000
commitbb7c2ddb23955e9757837601b1311398cf9ac9f7 (patch)
treef2a9fa440790315456af710be7f95f6d5afe395a /Zend/zend_list.c
parentbdd3b6042c538a58fbb629a832e19cabb4b507a7 (diff)
downloadphp-git-bb7c2ddb23955e9757837601b1311398cf9ac9f7.tar.gz
add the ability for curl_multi_info to introspect the handles.
# Zend commit doesn't break anything, so I'm committing it. If anyone # has problems, just speak up. :)
Diffstat (limited to 'Zend/zend_list.c')
-rw-r--r--Zend/zend_list.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/Zend/zend_list.c b/Zend/zend_list.c
index 348ecaf665..de3d11f265 100644
--- a/Zend/zend_list.c
+++ b/Zend/zend_list.c
@@ -43,6 +43,8 @@ ZEND_API int zend_list_insert(void *ptr, int type)
le.refcount=1;
index = zend_hash_next_free_element(&EG(regular_list));
+ le.id = index;
+
zend_hash_index_update(&EG(regular_list), index, (void *) &le, sizeof(zend_rsrc_list_entry), NULL);
return index;
}
@@ -77,7 +79,22 @@ ZEND_API void *_zend_list_find(int id, int *type TSRMLS_DC)
}
}
+ZEND_API int zend_list_id_by_pointer(void *p, int type TSRMLS_DC)
+{
+ zend_rsrc_list_entry *le;
+ HashPosition pos;
+ for (zend_hash_internal_pointer_reset_ex(&EG(regular_list), &pos);
+ zend_hash_get_current_data_ex(&EG(regular_list), (void *) &le, &pos) == SUCCESS;
+ zend_hash_move_forward_ex(&EG(regular_list), &pos)) {
+ if (le->type == type && le->ptr == p) {
+ return le->id;
+ }
+ }
+
+ return -1;
+}
+
ZEND_API int _zend_list_addref(int id TSRMLS_DC)
{
zend_rsrc_list_entry *le;