]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib: i_stream_get_data() - Mark invalid buffer code path unlikely
authorTimo Sirainen <timo.sirainen@open-xchange.com>
Wed, 11 Sep 2019 08:11:57 +0000 (11:11 +0300)
committerTimo Sirainen <timo.sirainen@open-xchange.com>
Fri, 13 Sep 2019 09:12:14 +0000 (09:12 +0000)
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

index 161f4a6b2f444488b9b42cecbf05f4082dabe864..83b8008495ca2e7e58581100659bbf0321c26c0e 100644 (file)
@@ -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