[PATCH] simplify #ifdef code

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

 



Reduce conditional code

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

Better to see this patch without space changes (and the
looking result).

diff --git a/common/lz_compress_tmpl.c b/common/lz_compress_tmpl.c
index 0305278..1bb5c75 100644
--- a/common/lz_compress_tmpl.c
+++ b/common/lz_compress_tmpl.c
@@ -403,27 +403,23 @@ match:        // RLE or dictionary (both are encoded by distance from ref (-1) a
 
         /* update the hash at match boundary */
 #if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32)
-        if (ip > anchor) {
+        if (ip > anchor)
 #endif
-        HASH_FUNC(hval, ip);
-        encoder->htab[hval].ref = (uint8_t *)ip;
+        {
+            HASH_FUNC(hval, ip);
+            encoder->htab[hval].ref = (uint8_t *)ip;
+            encoder->htab[hval].image_seg = seg;
+        }
         ip++;
-        encoder->htab[hval].image_seg = seg;
-#if defined(LZ_RGB16) || defined(LZ_RGB24) || defined(LZ_RGB32)
-    } else {ip++;
-    }
-#endif
 #if defined(LZ_RGB24) || defined(LZ_RGB32)
-        if (ip > anchor) {
+        if (ip > anchor)
 #endif
-        HASH_FUNC(hval, ip);
-        encoder->htab[hval].ref = (uint8_t *)ip;
+        {
+            HASH_FUNC(hval, ip);
+            encoder->htab[hval].ref = (uint8_t *)ip;
+            encoder->htab[hval].image_seg = seg;
+        }
         ip++;
-        encoder->htab[hval].image_seg = seg;
-#if defined(LZ_RGB24) || defined(LZ_RGB32)
-    } else {ip++;
-    }
-#endif
         /* assuming literal copy */
         encode_copy_count(encoder, MAX_COPY - 1);
         continue;
-- 
2.7.4

_______________________________________________
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]