diff options
author | Xinchen Hui <laruence@gmail.com> | 2015-02-02 13:23:16 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2015-02-02 13:23:16 +0800 |
commit | 942809909e1bc125db038796c0a1a0b53eeaca7d (patch) | |
tree | bddec8b44878488fc73e8fe2fb9e30b7ee4f9b67 /main/php_streams.h | |
parent | c9e44dc2dfa7ad91fe9253378a49e9f5b057992e (diff) | |
download | php-git-942809909e1bc125db038796c0a1a0b53eeaca7d.tar.gz |
Cleanup resource handling APIs
Diffstat (limited to 'main/php_streams.h')
-rw-r--r-- | main/php_streams.h | 9 |
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); |