[Spice-commits] common/quic.c

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Dec 10 08:21:53 UTC 2019


 common/quic.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

New commits:
commit 34807c600c442b985e7aa695856499aceeae1ae1
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Fri Oct 18 16:26:30 2019 +0100

    quic: Use G_UNLIKELY in some hot paths
    
    The buffers provided should be big enough to avoid to ask
    for more space much often.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/common/quic.c b/common/quic.c
index 304eb57..aea034c 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -394,7 +394,7 @@ static void more_io_words(Encoder *encoder)
 
 static inline void write_io_word(Encoder *encoder)
 {
-    if (encoder->io_now == encoder->io_end) {
+    if (G_UNLIKELY(encoder->io_now == encoder->io_end)) {
         more_io_words(encoder);
     }
     *(encoder->io_now++) = GUINT32_TO_LE(encoder->io_word);
@@ -442,7 +442,7 @@ static inline void flush(Encoder *encoder)
 
 static inline void read_io_word(Encoder *encoder)
 {
-    if (encoder->io_now == encoder->io_end) {
+    if (G_UNLIKELY(encoder->io_now == encoder->io_end)) {
         more_io_words(encoder);
     }
     if (spice_extra_checks) {


More information about the Spice-commits mailing list