[php-src] master: streams: make php_stream_flush() a proper function

From: Date: Mon, 27 Jul 2026 10:44:21 +0000
Subject: [php-src] master: streams: make php_stream_flush() a proper function
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-140224@lists.php.net to get a copy of this message
Author: Gina Peter Banyard (Girgias) Date: 2026-07-27T11:44:03+01:00 Commit: https://github.com/php/php-src/commit/0980c33acd0f71f9185a992b0e57860f1276389a Raw diff: https://github.com/php/php-src/commit/0980c33acd0f71f9185a992b0e57860f1276389a.diff streams: make php_stream_flush() a proper function By turning the _-prefixed version into a static extended version Changed paths: M main/php_streams.h M main/streams/streams.c Diff: diff --git a/main/php_streams.h b/main/php_streams.h index 313eff296a0f..8a8fa4b3a567 100644 --- a/main/php_streams.h +++ b/main/php_streams.h @@ -377,8 +377,7 @@ PHPAPI int php_stream_getc(php_stream *stream); PHPAPI int php_stream_putc(php_stream *stream, int c); -PHPAPI int _php_stream_flush(php_stream *stream, int closing); -#define php_stream_flush(stream) _php_stream_flush((stream), 0) +PHPAPI int php_stream_flush(php_stream *stream); PHPAPI int php_stream_sync(php_stream *stream, bool data_only); diff --git a/main/streams/streams.c b/main/streams/streams.c index accc8832e767..d7d3d70782fc 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -249,6 +249,7 @@ static int _php_stream_free_persistent(zval *zv, void *pStream) return le->ptr == pStream; } +static int php_stream_flush_ex(php_stream *stream, bool closing); PHPAPI int php_stream_free(php_stream *stream, int close_options) /* {{{ */ { @@ -336,7 +337,7 @@ fprintf(stderr, "stream_free: %s:%p[%s] preserve_handle=%d release_cast=%d remov if (stream->flags & PHP_STREAM_FLAG_WAS_WRITTEN || stream->writefilters.head) { /* make sure everything is saved */ - _php_stream_flush(stream, 1); + php_stream_flush_ex(stream, true); } /* If not called from the resource dtor, remove the stream from the resource list. */ @@ -1183,7 +1184,7 @@ static ssize_t php_stream_write_filtered(php_stream *stream, const char *buf, si return consumed; } -PHPAPI int _php_stream_flush(php_stream *stream, int closing) +static int php_stream_flush_ex(php_stream *stream, bool closing) { int ret = 0; @@ -1200,6 +1201,10 @@ PHPAPI int _php_stream_flush(php_stream *stream, int closing) return ret; } +PHPAPI int php_stream_flush(php_stream *stream) { + return php_stream_flush_ex(stream, false); +} + PHPAPI ssize_t php_stream_write(php_stream *stream, const char *buf, size_t count) { ssize_t bytes; @@ -1324,7 +1329,7 @@ PHPAPI int php_stream_seek(php_stream *stream, zend_off_t offset, int whence) bool is_start_seeking = whence == SEEK_SET && offset == 0; if (stream->writefilters.head) { - _php_stream_flush(stream, 0); + php_stream_flush(stream); if (!php_stream_are_filters_seekable(stream->writefilters.head, is_start_seeking, PHP_STREAM_FILTER_WRITE)) { return -1;

« previous php.cvs (#140224) next »