From ed4e139c58cb949dae43a53d57a0790c38b95d95 Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Wed, 11 Sep 2019 11:11:57 +0300 Subject: [PATCH] lib: i_stream_get_data() - Mark invalid buffer code path unlikely This really isn't expected to happen, so marking it unlikely optimizes slightly callers that cause i_stream_get_data() to be called a huge number of times. --- src/lib/istream.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/istream.c b/src/lib/istream.c index 161f4a6b2f..83b8008495 100644 --- a/src/lib/istream.c +++ b/src/lib/istream.c @@ -679,7 +679,7 @@ i_stream_get_data(struct istream *stream, size_t *size_r) return uchar_empty_ptr; } - if (i_stream_is_buffer_invalid(_stream)) { + if (unlikely(i_stream_is_buffer_invalid(_stream))) { /* This stream may be using parent's buffer directly as _stream->buffer, but the parent stream has already been modified indirectly. This means that the buffer might no -- 2.47.3