Skip to content

Commit f4f0162

Browse files
committed
ext/standard: Use new php_streams fast ZPP specifier
1 parent 5bf7259 commit f4f0162

File tree

2 files changed

+7
-12
lines changed

2 files changed

+7
-12
lines changed

ext/standard/formatted_print.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -860,18 +860,16 @@ PHP_FUNCTION(fprintf)
860860
php_stream *stream;
861861
char *format;
862862
size_t format_len;
863-
zval *arg1, *args;
864-
int argc;
863+
zval *args = NULL;
864+
int argc = 0;
865865
zend_string *result;
866866

867867
ZEND_PARSE_PARAMETERS_START(2, -1)
868-
Z_PARAM_RESOURCE(arg1)
868+
PHP_Z_PARAM_STREAM(stream)
869869
Z_PARAM_STRING(format, format_len)
870870
Z_PARAM_VARIADIC('*', args, argc)
871871
ZEND_PARSE_PARAMETERS_END();
872872

873-
php_stream_from_zval(stream, arg1);
874-
875873
result = php_formatted_print(format, format_len, args, argc, 2);
876874
if (result == NULL) {
877875
RETURN_THROWS();
@@ -890,19 +888,17 @@ PHP_FUNCTION(vfprintf)
890888
php_stream *stream;
891889
char *format;
892890
size_t format_len;
893-
zval *arg1, *args;
891+
zval *args;
894892
zend_array *array;
895893
int argc;
896894
zend_string *result;
897895

898896
ZEND_PARSE_PARAMETERS_START(3, 3)
899-
Z_PARAM_RESOURCE(arg1)
897+
PHP_Z_PARAM_STREAM(stream)
900898
Z_PARAM_STRING(format, format_len)
901899
Z_PARAM_ARRAY_HT(array)
902900
ZEND_PARSE_PARAMETERS_END();
903901

904-
php_stream_from_zval(stream, arg1);
905-
906902
args = php_formatted_print_get_array(array, &argc);
907903

908904
result = php_formatted_print(format, format_len, args, argc, -1);

ext/standard/user_filters.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -439,19 +439,18 @@ PHP_FUNCTION(stream_bucket_append)
439439
/* {{{ Create a new bucket for use on the current stream */
440440
PHP_FUNCTION(stream_bucket_new)
441441
{
442-
zval *zstream, zbucket;
442+
zval zbucket;
443443
php_stream *stream;
444444
char *buffer;
445445
char *pbuffer;
446446
size_t buffer_len;
447447
php_stream_bucket *bucket;
448448

449449
ZEND_PARSE_PARAMETERS_START(2, 2)
450-
Z_PARAM_ZVAL(zstream)
450+
PHP_Z_PARAM_STREAM(stream)
451451
Z_PARAM_STRING(buffer, buffer_len)
452452
ZEND_PARSE_PARAMETERS_END();
453453

454-
php_stream_from_zval(stream, zstream);
455454
pbuffer = pemalloc(buffer_len, php_stream_is_persistent(stream));
456455

457456
memcpy(pbuffer, buffer, buffer_len);

0 commit comments

Comments
 (0)