Skip to content

Commit 9285559

Browse files
committed
ext/bz2: Use new php_streams fast ZPP specifier
1 parent ff40eed commit 9285559

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

ext/bz2/bz2.c

+8-12
Original file line numberDiff line numberDiff line change
@@ -303,16 +303,15 @@ static PHP_MINFO_FUNCTION(bz2)
303303
/* {{{ Reads up to length bytes from a BZip2 stream, or 1024 bytes if length is not specified */
304304
PHP_FUNCTION(bzread)
305305
{
306-
zval *bz;
307306
zend_long len = 1024;
308307
php_stream *stream;
309308
zend_string *data;
310309

311-
if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &bz, &len)) {
312-
RETURN_THROWS();
313-
}
314-
315-
php_stream_from_zval(stream, bz);
310+
ZEND_PARSE_PARAMETERS_START(1, 2)
311+
PHP_Z_PARAM_STREAM(stream)
312+
Z_PARAM_OPTIONAL
313+
Z_PARAM_LONG(len)
314+
ZEND_PARSE_PARAMETERS_END();
316315

317316
if (len < 0) {
318317
zend_argument_value_error(2, "must be greater than or equal to 0");
@@ -563,17 +562,14 @@ PHP_FUNCTION(bzdecompress)
563562
The central error handling interface, does the work for bzerrno, bzerrstr and bzerror */
564563
static void php_bz2_error(INTERNAL_FUNCTION_PARAMETERS, int opt)
565564
{
566-
zval *bzp; /* BZip2 Resource Pointer */
567565
php_stream *stream;
568566
const char *errstr; /* Error string */
569567
int errnum; /* Error number */
570568
struct php_bz2_stream_data_t *self;
571569

572-
if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &bzp) == FAILURE) {
573-
RETURN_THROWS();
574-
}
575-
576-
php_stream_from_zval(stream, bzp);
570+
ZEND_PARSE_PARAMETERS_START(1, 1)
571+
PHP_Z_PARAM_STREAM(stream)
572+
ZEND_PARSE_PARAMETERS_END();
577573

578574
if (!php_stream_is(stream, PHP_STREAM_IS_BZIP2)) {
579575
zend_argument_type_error(1, "must be a bz2 stream");

0 commit comments

Comments
 (0)