[PATCH spice-common 3/5] lz: Avoid temporary variable

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

 



Use a break to exit the loop instead of using a variable.

Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 common/lz_decompress_tmpl.c | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/common/lz_decompress_tmpl.c b/common/lz_decompress_tmpl.c
index 04a5121..0189f86 100644
--- a/common/lz_decompress_tmpl.c
+++ b/common/lz_decompress_tmpl.c
@@ -222,9 +222,8 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size)
     OUT_PIXEL    *op = out_buf;
     OUT_PIXEL    *op_limit = out_buf + size;
     uint32_t ctrl = decode(encoder);
-    int loop = TRUE;
 
-    do {
+    for (;;) {
         const OUT_PIXEL *ref = op;
         uint32_t len = ctrl >> 5;
         uint32_t ofs = (ctrl & 31) << 8; // 5 MSb of distance
@@ -312,12 +311,11 @@ static size_t FNAME(decompress)(Encoder *encoder, OUT_PIXEL *out_buf, int size)
             }
         }
 
-        if (LZ_EXPECT_CONDITIONAL(op < op_limit)) {
-            ctrl = decode(encoder);
-        } else {
-            loop = FALSE;
+        if (LZ_UNEXPECT_CONDITIONAL(op >= op_limit)) {
+            break;
         }
-    } while (LZ_EXPECT_CONDITIONAL(loop));
+        ctrl = decode(encoder);
+    }
 
     return (op - out_buf);
 }
-- 
2.14.3

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




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