1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

ext/standard: Use new php_streams fast ZPP specifier

This commit is contained in:
Gina Peter Banyard
2025-03-03 15:57:44 +00:00
parent f3857dd613
commit da1fde28f3
2 changed files with 7 additions and 12 deletions

View File

@@ -860,18 +860,16 @@ PHP_FUNCTION(fprintf)
php_stream *stream;
char *format;
size_t format_len;
zval *arg1, *args;
int argc;
zval *args = NULL;
int argc = 0;
zend_string *result;
ZEND_PARSE_PARAMETERS_START(2, -1)
Z_PARAM_RESOURCE(arg1)
PHP_Z_PARAM_STREAM(stream)
Z_PARAM_STRING(format, format_len)
Z_PARAM_VARIADIC('*', args, argc)
ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
result = php_formatted_print(format, format_len, args, argc, 2);
if (result == NULL) {
RETURN_THROWS();
@@ -890,19 +888,17 @@ PHP_FUNCTION(vfprintf)
php_stream *stream;
char *format;
size_t format_len;
zval *arg1, *args;
zval *args;
zend_array *array;
int argc;
zend_string *result;
ZEND_PARSE_PARAMETERS_START(3, 3)
Z_PARAM_RESOURCE(arg1)
PHP_Z_PARAM_STREAM(stream)
Z_PARAM_STRING(format, format_len)
Z_PARAM_ARRAY_HT(array)
ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, arg1);
args = php_formatted_print_get_array(array, &argc);
result = php_formatted_print(format, format_len, args, argc, -1);

View File

@@ -439,7 +439,7 @@ PHP_FUNCTION(stream_bucket_append)
/* {{{ Create a new bucket for use on the current stream */
PHP_FUNCTION(stream_bucket_new)
{
zval *zstream, zbucket;
zval zbucket;
php_stream *stream;
char *buffer;
char *pbuffer;
@@ -447,11 +447,10 @@ PHP_FUNCTION(stream_bucket_new)
php_stream_bucket *bucket;
ZEND_PARSE_PARAMETERS_START(2, 2)
Z_PARAM_ZVAL(zstream)
PHP_Z_PARAM_STREAM(stream)
Z_PARAM_STRING(buffer, buffer_len)
ZEND_PARSE_PARAMETERS_END();
php_stream_from_zval(stream, zstream);
pbuffer = pemalloc(buffer_len, php_stream_is_persistent(stream));
memcpy(pbuffer, buffer, buffer_len);