diff options
author | Xinchen Hui <laruence@gmail.com> | 2015-02-02 13:56:20 +0800 |
---|---|---|
committer | Xinchen Hui <laruence@gmail.com> | 2015-02-02 13:56:20 +0800 |
commit | 7ec8eb380dd87caa877490d3cd0b1dce41e5187e (patch) | |
tree | 6ae8cd8af0255384f644334d171914892b192d2e | |
parent | 38efb690c0772d6d3bab20a1b1fee383eca1c04d (diff) | |
download | php-git-7ec8eb380dd87caa877490d3cd0b1dce41e5187e.tar.gz |
Use resource directly
-rw-r--r-- | ext/standard/file.c | 6 | ||||
-rw-r--r-- | main/php_streams.h | 1 |
2 files changed, 3 insertions, 4 deletions
diff --git a/ext/standard/file.c b/ext/standard/file.c index 5d9efa60a6..49b3689c53 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -128,10 +128,8 @@ php_file_globals file_globals; /* }}} */ #define PHP_STREAM_TO_ZVAL(stream, arg) \ - php_stream_from_zval_no_verify(stream, arg); \ - if (stream == NULL) { \ - RETURN_FALSE; \ - } + ZEND_ASSERT(Z_TYPE_P(arg) == IS_RESOURCE); \ + php_stream_from_res(stream, Z_RES_P(arg)); /* {{{ ZTS-stuff / Globals / Prototypes */ diff --git a/main/php_streams.h b/main/php_streams.h index 913c4c3bb4..177624df48 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -265,6 +265,7 @@ END_EXTERN_C() RETURN_FALSE; \ } \ } while (0) +#define php_stream_from_res_no_verify(xstr, pzval) (xstr) = (php_stream*)zend_fetch_resource((res), "stream", NULL, php_file_le_stream(), php_file_le_pstream()) #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() |