[Spice-devel] [spice-common v2 2/6] quic: Use DEFwminext constant rather than wminext variable

Christophe Fergeau cfergeau at redhat.com
Tue Aug 1 13:55:05 UTC 2017


We never change its value, so we basically have 2 constants for the
same thing, DEFwminext and wminext. This commit removes the latter

Signed-off-by: Christophe Fergeau <cfergeau at redhat.com>
---
 common/quic.c          |  7 ++-----
 common/quic_rgb_tmpl.c | 16 ++++++++--------
 common/quic_tmpl.c     | 16 ++++++++--------
 3 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/common/quic.c b/common/quic.c
index 1deda47..04fdd62 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -175,9 +175,6 @@ struct Encoder {
 /* target wait mask index */
 static const int wmimax = DEFwmimax;
 
-/* number of symbols to encode before increasing wait mask index */
-static const int wminext = DEFwminext;
-
 /* bppmask[i] contains i ones as lsb-s */
 static const unsigned long int bppmask[33] = {
     0x00000000, /* [0] */
@@ -1066,7 +1063,7 @@ static int encoder_reset(Encoder *encoder, uint32_t *io_ptr, uint32_t *io_ptr_en
     encoder->rgb_state.waitcnt = 0;
     encoder->rgb_state.tabrand_seed = stabrand();
     encoder->rgb_state.wmidx = DEFwmistart;
-    encoder->rgb_state.wmileft = wminext;
+    encoder->rgb_state.wmileft = DEFwminext;
     set_wm_trigger(&encoder->rgb_state);
 
 #if defined(RLE) && defined(RLE_STAT)
@@ -1130,7 +1127,7 @@ static int encoder_reset_channels(Encoder *encoder, int channels, int width, int
         encoder->channels[i].state.waitcnt = 0;
         encoder->channels[i].state.tabrand_seed = stabrand();
         encoder->channels[i].state.wmidx = DEFwmistart;
-        encoder->channels[i].state.wmileft = wminext;
+        encoder->channels[i].state.wmileft = DEFwminext;
         set_wm_trigger(&encoder->channels[i].state);
 
 #if defined(RLE) && defined(RLE_STAT)
diff --git a/common/quic_rgb_tmpl.c b/common/quic_rgb_tmpl.c
index f807a0c..bd2a70a 100644
--- a/common/quic_rgb_tmpl.c
+++ b/common/quic_rgb_tmpl.c
@@ -294,7 +294,7 @@ static void FNAME(compress_row0)(Encoder *encoder, const PIXEL *cur_row,
 
         encoder->rgb_state.wmidx++;
         set_wm_trigger(&encoder->rgb_state);
-        encoder->rgb_state.wmileft = wminext;
+        encoder->rgb_state.wmileft = DEFwminext;
     }
 
     if (width) {
@@ -307,7 +307,7 @@ static void FNAME(compress_row0)(Encoder *encoder, const PIXEL *cur_row,
 
     spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
     spice_assert(encoder->rgb_state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    spice_assert(DEFwminext > 0);
 }
 
 #define COMPRESS_ONE_0(channel) \
@@ -440,7 +440,7 @@ static void FNAME(compress_row)(Encoder *encoder,
 
         encoder->rgb_state.wmidx++;
         set_wm_trigger(&encoder->rgb_state);
-        encoder->rgb_state.wmileft = wminext;
+        encoder->rgb_state.wmileft = DEFwminext;
     }
 
     if (width) {
@@ -453,7 +453,7 @@ static void FNAME(compress_row)(Encoder *encoder,
 
     spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
     spice_assert(encoder->rgb_state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    spice_assert(DEFwminext > 0);
 }
 
 #endif
@@ -556,7 +556,7 @@ static void FNAME(uncompress_row0)(Encoder *encoder,
 
         encoder->rgb_state.wmidx++;
         set_wm_trigger(&encoder->rgb_state);
-        encoder->rgb_state.wmileft = wminext;
+        encoder->rgb_state.wmileft = DEFwminext;
     }
 
     if (width) {
@@ -569,7 +569,7 @@ static void FNAME(uncompress_row0)(Encoder *encoder,
 
     spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
     spice_assert(encoder->rgb_state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    spice_assert(DEFwminext > 0);
 }
 
 #define UNCOMPRESS_ONE_0(channel) \
@@ -710,7 +710,7 @@ static void FNAME(uncompress_row)(Encoder *encoder,
 
         encoder->rgb_state.wmidx++;
         set_wm_trigger(&encoder->rgb_state);
-        encoder->rgb_state.wmileft = wminext;
+        encoder->rgb_state.wmileft = DEFwminext;
     }
 
     if (width) {
@@ -723,7 +723,7 @@ static void FNAME(uncompress_row)(Encoder *encoder,
 
     spice_assert((int)encoder->rgb_state.wmidx <= wmimax);
     spice_assert(encoder->rgb_state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    spice_assert(DEFwminext > 0);
 }
 
 #undef PIXEL
diff --git a/common/quic_tmpl.c b/common/quic_tmpl.c
index e839346..0ad9dd6 100644
--- a/common/quic_tmpl.c
+++ b/common/quic_tmpl.c
@@ -222,7 +222,7 @@ static void FNAME(compress_row0)(Encoder *encoder, Channel *channel, const PIXEL
 
         channel->state.wmidx++;
         set_wm_trigger(&channel->state);
-        channel->state.wmileft = wminext;
+        channel->state.wmileft = DEFwminext;
     }
 
     if (width) {
@@ -235,7 +235,7 @@ static void FNAME(compress_row0)(Encoder *encoder, Channel *channel, const PIXEL
 
     spice_assert((int)channel->state.wmidx <= wmimax);
     spice_assert(channel->state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    spice_assert(DEFwminext > 0);
 }
 
 static void FNAME(compress_row_seg)(Encoder *encoder, Channel *channel, int i,
@@ -364,7 +364,7 @@ static void FNAME(compress_row)(Encoder *encoder, Channel *channel,
 
         channel->state.wmidx++;
         set_wm_trigger(&channel->state);
-        channel->state.wmileft = wminext;
+        channel->state.wmileft = DEFwminext;
     }
 
     if (width) {
@@ -377,7 +377,7 @@ static void FNAME(compress_row)(Encoder *encoder, Channel *channel,
 
     spice_assert((int)channel->state.wmidx <= wmimax);
     spice_assert(channel->state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    spice_assert(DEFwminext > 0);
 }
 
 static void FNAME(uncompress_row0_seg)(Encoder *encoder, Channel *channel, int i,
@@ -464,7 +464,7 @@ static void FNAME(uncompress_row0)(Encoder *encoder, Channel *channel,
 
         channel->state.wmidx++;
         set_wm_trigger(&channel->state);
-        channel->state.wmileft = wminext;
+        channel->state.wmileft = DEFwminext;
     }
 
     if (width) {
@@ -477,7 +477,7 @@ static void FNAME(uncompress_row0)(Encoder *encoder, Channel *channel,
 
     spice_assert((int)channel->state.wmidx <= wmimax);
     spice_assert(channel->state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    spice_assert(DEFwminext > 0);
 }
 
 static void FNAME(uncompress_row_seg)(Encoder *encoder, Channel *channel,
@@ -602,7 +602,7 @@ static void FNAME(uncompress_row)(Encoder *encoder, Channel *channel,
 
         channel->state.wmidx++;
         set_wm_trigger(&channel->state);
-        channel->state.wmileft = wminext;
+        channel->state.wmileft = DEFwminext;
     }
 
     if (width) {
@@ -615,7 +615,7 @@ static void FNAME(uncompress_row)(Encoder *encoder, Channel *channel,
 
     spice_assert((int)channel->state.wmidx <= wmimax);
     spice_assert(channel->state.wmidx <= 32);
-    spice_assert(wminext > 0);
+    spice_assert(DEFwminext > 0);
 }
 
 #undef PIXEL
-- 
2.13.3



More information about the Spice-devel mailing list