com php-src: Use resource directly: ext/standard/file.c main/php_streams.h

From: Date: Mon, 02 Feb 2015 05:56:20 +0000
Subject: com php-src: Use resource directly: ext/standard/file.c main/php_streams.h
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-84606@lists.php.net to get a copy of this message
Commit: 7ec8eb380dd87caa877490d3cd0b1dce41e5187e Author: Xinchen Hui <laruence@gmail.com> Mon, 2 Feb 2015 13:56:20 +0800 Parents: 38efb690c0772d6d3bab20a1b1fee383eca1c04d Branches: master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7ec8eb380dd87caa877490d3cd0b1dce41e5187e Log: Use resource directly Changed paths: M ext/standard/file.c M main/php_streams.h Diff: diff --git a/ext/standard/file.c b/ext/standard/file.c index 5d9efa6..49b3689 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 913c4c3..177624d 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()

« previous php.cvs (#84606) next »