mirror of
https://github.com/php/php-src.git
synced 2025-01-22 11:44:09 +08:00
fpm zlog_stream_buf_alloc_ex little simplifications. (#8224)
This commit is contained in:
parent
e948d3c9c8
commit
814374faa1
@ -286,14 +286,8 @@ static zlog_bool zlog_stream_buf_alloc_ex(struct zlog_stream *stream, size_t nee
|
||||
{
|
||||
char *buf;
|
||||
size_t size = stream->buf.size ?: stream->buf_init_size;
|
||||
|
||||
if (stream->buf.data) {
|
||||
size = MIN(zlog_limit, MAX(size * 2, needed));
|
||||
buf = realloc(stream->buf.data, size);
|
||||
} else {
|
||||
size = MIN(zlog_limit, MAX(size, needed));
|
||||
buf = malloc(size);
|
||||
}
|
||||
size = MIN(zlog_limit, MAX((stream->buf.data ? (size << 1) : size), needed));
|
||||
buf = realloc(stream->buf.data, size);
|
||||
|
||||
if (buf == NULL) {
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user