> I didn't quite understand what you did here. Can you please explain? Is it > absolutely necessary to add this hack just for curl? >
I added the ability to find a resource identifier from a resource. Something I think is generally pretty useful. :) Adding an ID field to the list_entry isn't absolutely necessary, but it seems like the right thing todo (i could just get the current key). -Sterling > Andi > > At 04:58 PM 4/2/2003 +0000, Sterling Hughes wrote: > >sterling Wed Apr 2 11:58:52 2003 EDT > > > > Modified files: > > /ZendEngine2 zend_list.c zend_list.h > > /php4/ext/curl multi.c > > Log: > > 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. :) > > > > > >Index: ZendEngine2/zend_list.c > >diff -u ZendEngine2/zend_list.c:1.57 ZendEngine2/zend_list.c:1.58 > >--- ZendEngine2/zend_list.c:1.57 Fri Jan 31 20:49:14 2003 > >+++ ZendEngine2/zend_list.c Wed Apr 2 11:58:52 2003 > >@@ -17,7 +17,7 @@ > > +----------------------------------------------------------------------+ > > */ > > > >-/* $Id: zend_list.c,v 1.57 2003/02/01 01:49:14 sniper Exp $ */ > >+/* $Id: zend_list.c,v 1.58 2003/04/02 16:58:52 sterling Exp $ */ > > > > /* resource lists */ > > > >@@ -43,6 +43,8 @@ > > 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 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; > >Index: ZendEngine2/zend_list.h > >diff -u ZendEngine2/zend_list.h:1.42 ZendEngine2/zend_list.h:1.43 > >--- ZendEngine2/zend_list.h:1.42 Fri Jan 31 20:49:14 2003 > >+++ ZendEngine2/zend_list.h Wed Apr 2 11:58:52 2003 > >@@ -17,7 +17,7 @@ > > +----------------------------------------------------------------------+ > > */ > > > >-/* $Id: zend_list.h,v 1.42 2003/02/01 01:49:14 sniper Exp $ */ > >+/* $Id: zend_list.h,v 1.43 2003/04/02 16:58:52 sterling Exp $ */ > > > > #ifndef ZEND_LIST_H > > #define ZEND_LIST_H > >@@ -34,6 +34,7 @@ > > void *ptr; > > int type; > > int refcount; > >+ int id; > > } zend_rsrc_list_entry; > > > > typedef void (*rsrc_dtor_func_t)(zend_rsrc_list_entry *rsrc TSRMLS_DC); > >@@ -74,6 +75,7 @@ > > ZEND_API int _zend_list_addref(int id TSRMLS_DC); > > ZEND_API int _zend_list_delete(int id TSRMLS_DC); > > 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); > > > > #define zend_list_addref(id) _zend_list_addref(id TSRMLS_CC) > > #define zend_list_delete(id) _zend_list_delete(id TSRMLS_CC) > >Index: php4/ext/curl/multi.c > >diff -u php4/ext/curl/multi.c:1.7 php4/ext/curl/multi.c:1.8 > >--- php4/ext/curl/multi.c:1.7 Mon Mar 17 10:06:11 2003 > >+++ php4/ext/curl/multi.c Wed Apr 2 11:58:52 2003 > >@@ -16,7 +16,7 @@ > > +----------------------------------------------------------------------+ > > */ > > > >-/* $Id: multi.c,v 1.7 2003/03/17 15:06:11 sniper Exp $ */ > >+/* $Id: multi.c,v 1.8 2003/04/02 16:58:52 sterling Exp $ */ > > > > #define ZEND_INCLUDE_FULL_WINDOWS_HEADERS > > > >@@ -221,7 +221,7 @@ > > array_init(return_value); > > add_assoc_long(return_value, "msg", tmp_msg->msg); > > add_assoc_long(return_value, "result", tmp_msg->data.result); > >-/* add_assoc_resource(return_value, "handle", > >_find_handle(tmp_msg->easy_handle)); */ > >+ add_assoc_resource(return_value, "handle", > >zend_list_id_by_pointer(tmp_msg->easy_handle, le_curl TSRMLS_CC)); > > add_assoc_string(return_value, "whatever", (char *) > >tmp_msg->data.whatever, 1); > > } > > /* }}} */ > > > > > > > >-- > >PHP CVS Mailing List (http://www.php.net/) > >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php