diff --git a/php_uv.c b/php_uv.c index a9bd657..5cbc0ce 100644 --- a/php_uv.c +++ b/php_uv.c @@ -62,7 +62,6 @@ uv->address = NULL; \ uv->read2_cb = NULL; \ uv->getaddr_cb = NULL; \ - uv->fs_poll_cb = NULL; \ uv->poll_cb = NULL; \ } @@ -515,11 +514,6 @@ void static destruct_uv(zend_rsrc_list_entry *rsrc TSRMLS_DC) zval_ptr_dtor(&obj->getaddr_cb); obj->getaddr_cb = NULL; } - if (obj->fs_poll_cb) { - PHP_UV_DEBUG_PRINT("zval_ptr_dtor: fs_poll_cb\n"); - zval_ptr_dtor(&obj->fs_poll_cb); - obj->fs_poll_cb = NULL; - } if (obj->poll_cb) { PHP_UV_DEBUG_PRINT("zval_ptr_dtor: poll_cb\n"); zval_ptr_dtor(&obj->poll_cb); @@ -1232,7 +1226,7 @@ static void php_uv_fs_poll_cb(uv_fs_poll_t* handle, int status, const uv_statbuf params[2] = &p; params[3] = &c; - php_uv_do_callback(&retval_ptr, uv->fs_poll_cb, params, 4 TSRMLS_CC); + php_uv_do_callback2(&retval_ptr, uv, params, 4, PHP_UV_FS_POLL_CB TSRMLS_CC); zval_ptr_dtor(&rsc); zval_ptr_dtor(&stat); @@ -5709,21 +5703,23 @@ PHP_FUNCTION(uv_fs_poll_init) */ PHP_FUNCTION(uv_fs_poll_start) { - zval *handle, *callback = NULL; + zval *handle = NULL; php_uv_t *uv; char *path; unsigned long interval = 0; int error, path_len = 0; + zend_fcall_info fci = empty_fcall_info; + zend_fcall_info_cache fcc = empty_fcall_info_cache; + php_uv_cb_t *cb; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, - "zzsl", &handle, &callback, &path, &path_len, &interval) == FAILURE) { + "zfsl", &handle, &fci, &fcc, &path, &path_len, &interval) == FAILURE) { return; } ZEND_FETCH_RESOURCE(uv, php_uv_t *, &handle, -1, PHP_UV_RESOURCE_NAME, uv_resource_handle); - Z_ADDREF_P(callback); - uv->fs_poll_cb = callback; + php_uv_cb_init(&cb, uv, &fci, &fcc, PHP_UV_FS_POLL_CB); uv->uv.fs_poll.data = uv; zend_list_addref(uv->resource_id); diff --git a/php_uv.h b/php_uv.h index 4bda6e0..e548d6d 100644 --- a/php_uv.h +++ b/php_uv.h @@ -124,7 +124,6 @@ typedef struct { zval *address; zval *read2_cb; zval *getaddr_cb; - zval *fs_poll_cb; zval *poll_cb; php_uv_cb_t *callback[PHP_UV_CB_MAX]; } php_uv_t;