We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e948d3c commit 814374fCopy full SHA for 814374f
sapi/fpm/fpm/zlog.c
@@ -286,14 +286,8 @@ static zlog_bool zlog_stream_buf_alloc_ex(struct zlog_stream *stream, size_t nee
286
{
287
char *buf;
288
size_t size = stream->buf.size ?: stream->buf_init_size;
289
-
290
- if (stream->buf.data) {
291
- size = MIN(zlog_limit, MAX(size * 2, needed));
292
- buf = realloc(stream->buf.data, size);
293
- } else {
294
- size = MIN(zlog_limit, MAX(size, needed));
295
- buf = malloc(size);
296
- }
+ size = MIN(zlog_limit, MAX((stream->buf.data ? (size << 1) : size), needed));
+ buf = realloc(stream->buf.data, size);
297
298
if (buf == NULL) {
299
return 0;
0 commit comments