[PATCH spice-common] quic: Use G_UNLIKELY in some hot paths

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The buffers provided should be big enough to avoid to ask
for more space much often.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 common/quic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/quic.c b/common/quic.c
index e1c439f..d24a0f6 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -396,7 +396,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);
@@ -444,7 +444,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) {
-- 
2.21.0

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]