[Spice-devel] [PATCH] simplify #ifdef code
Frediano Ziglio
fziglio at redhat.com
Fri May 13 12:17:32 UTC 2016
Reduce conditional code
Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
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
More information about the Spice-devel
mailing list