summaryrefslogtreecommitdiff
path: root/main/php_streams.h
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 /main/php_streams.h
parentc9e44dc2dfa7ad91fe9253378a49e9f5b057992e (diff)
downloadphp-git-942809909e1bc125db038796c0a1a0b53eeaca7d.tar.gz
Cleanup resource handling APIs
Diffstat (limited to 'main/php_streams.h')
-rw-r--r--main/php_streams.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/main/php_streams.h b/main/php_streams.h
index 6240fdd653..9a22a531f4 100644
--- a/main/php_streams.h
+++ b/main/php_streams.h
@@ -253,8 +253,13 @@ END_EXTERN_C()
* when the resources are auto-destructed */
#define php_stream_to_zval(stream, zval) { ZVAL_RES(zval, (stream)->res); (stream)->__exposed++; }
-#define php_stream_from_zval(xstr, pzval) ZEND_FETCH_RESOURCE2((xstr), php_stream *, (pzval), -1, "stream", php_file_le_stream(), php_file_le_pstream())
-#define php_stream_from_zval_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource((pzval), -1, "stream", NULL, 2, php_file_le_stream(), php_file_le_pstream())
+#define php_stream_from_zval(xstr, pzval) do { \
+ if (((xstr) = (php_stream*)zend_fetch_resource2_ex((pzval), \
+ "stream", NULL, php_file_le_stream(), php_file_le_pstream())) == NULL) { \
+ RETURN_FALSE; \
+ } \
+} while (0)
+#define php_stream_from_zval_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource2_ex((pzval), "stream", NULL, php_file_le_stream(), php_file_le_pstream())
BEGIN_EXTERN_C()
PHPAPI php_stream *php_stream_encloses(php_stream *enclosing, php_stream *enclosed);