summaryrefslogtreecommitdiff
path: root/ext/curl/share.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2015-02-02 13:23:16 +0800
committerXinchen Hui <laruence@gmail.com>2015-02-02 13:23:16 +0800
commit942809909e1bc125db038796c0a1a0b53eeaca7d (patch)
treebddec8b44878488fc73e8fe2fb9e30b7ee4f9b67 /ext/curl/share.c
parentc9e44dc2dfa7ad91fe9253378a49e9f5b057992e (diff)
downloadphp-git-942809909e1bc125db038796c0a1a0b53eeaca7d.tar.gz
Cleanup resource handling APIs
Diffstat (limited to 'ext/curl/share.c')
-rw-r--r--ext/curl/share.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/ext/curl/share.c b/ext/curl/share.c
index 5fc64d0085..294b475b31 100644
--- a/ext/curl/share.c
+++ b/ext/curl/share.c
@@ -46,7 +46,7 @@ PHP_FUNCTION(curl_share_init)
sh->share = curl_share_init();
- ZEND_REGISTER_RESOURCE(return_value, sh, le_curl_share_handle);
+ RETURN_RES(zend_register_resource(sh, le_curl_share_handle));
}
/* }}} */
@@ -61,7 +61,10 @@ PHP_FUNCTION(curl_share_close)
return;
}
- ZEND_FETCH_RESOURCE(sh, php_curlsh *, z_sh, -1, le_curl_share_handle_name, le_curl_share_handle);
+ if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(z_sh), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
+ RETURN_FALSE;
+ }
+
zend_list_close(Z_RES_P(z_sh));
}
/* }}} */
@@ -103,7 +106,9 @@ PHP_FUNCTION(curl_share_setopt)
return;
}
- ZEND_FETCH_RESOURCE(sh, php_curlsh *, zid, -1, le_curl_share_handle_name, le_curl_share_handle);
+ if ((sh = (php_curlsh *)zend_fetch_resource(Z_RES_P(zid), le_curl_share_handle_name, le_curl_share_handle)) == NULL) {
+ RETURN_FALSE;
+ }
if (!_php_curl_share_setopt(sh, options, zvalue, return_value)) {
RETURN_TRUE;