[Spice-devel] [spice-common 2/2] quic: Use upper-case for 'evol' constant name

Christophe Fergeau cfergeau at redhat.com
Mon Jul 3 16:36:42 UTC 2017


Constants, especially when defined using #define usually use upper-case
naming.
---
 common/quic.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/common/quic.c b/common/quic.c
index b0ca74c..9da8c37 100644
--- a/common/quic.c
+++ b/common/quic.c
@@ -179,7 +179,7 @@ static const int wmimax = DEFwmimax;
 static const int wminext = DEFwminext;
 
 /* model evolution mode */
-#define evol DEFevol
+#define EVOL DEFevol
 
 /* bppmask[i] contains i ones as lsb-s */
 static const unsigned long int bppmask[33] = {
@@ -248,14 +248,14 @@ static unsigned int tabrand(unsigned int *tabrand_seed)
     return tabrand_chaos[++*tabrand_seed & TABRAND_SEEDMASK];
 }
 
-static const unsigned short besttrigtab[3][11] = { /* array of wm_trigger for waitmask and evol,
+static const unsigned short besttrigtab[3][11] = { /* array of wm_trigger for waitmask and EVOL,
                                                     used by set_wm_trigger() */
     /* 1 */ { 550, 900, 800, 700, 500, 350, 300, 200, 180, 180, 160},
     /* 3 */ { 110, 550, 900, 800, 550, 400, 350, 250, 140, 160, 140},
     /* 5 */ { 100, 120, 550, 900, 700, 500, 400, 300, 220, 250, 160}
 };
 
-/* set wm_trigger knowing waitmask (param) and evol (glob)*/
+/* set wm_trigger knowing waitmask (param) and EVOL (glob)*/
 static void set_wm_trigger(CommonState *state)
 {
     unsigned int wm = state->wmidx;
@@ -263,9 +263,9 @@ static void set_wm_trigger(CommonState *state)
         wm = 10;
     }
 
-    spice_assert(evol < 6);
+    spice_assert(EVOL < 6);
 
-    state->wm_trigger = besttrigtab[evol / 2][wm];
+    state->wm_trigger = besttrigtab[EVOL / 2][wm];
 
     spice_assert(state->wm_trigger <= 2000);
     spice_assert(state->wm_trigger >= 1);
@@ -878,7 +878,7 @@ static void find_model_params(Encoder *encoder,
     /* The only valid values are 1, 3 and 5.
        0, 2 and 4 are obsolete and the rest of the
        values are considered out of the range. */
-    SPICE_VERIFY(evol == 1 || evol == 3 || evol == 5);
+    SPICE_VERIFY(EVOL == 1 || EVOL == 3 || EVOL == 5);
     spice_assert(bpc <= 8 && bpc > 0);
 
     *ncounters = 8;
@@ -887,7 +887,7 @@ static void find_model_params(Encoder *encoder,
 
     *n_buckets_ptrs = 0;  /* ==0 means: not set yet */
 
-    switch (evol) {   /* set repfirst firstsize repnext mulsize */
+    switch (EVOL) {   /* set repfirst firstsize repnext mulsize */
     case 1: /* buckets contain following numbers of contexts: 1 1 1 2 2 4 4 8 8 ... */
         *repfirst = 3;
         *firstsize = 1;
@@ -907,7 +907,7 @@ static void find_model_params(Encoder *encoder,
         *mulsize = 4;
         break;
     default:
-        encoder->usr->error(encoder->usr, "findmodelparams(): evol out of range!!!\n");
+        encoder->usr->error(encoder->usr, "findmodelparams(): EVOL out of range!!!\n");
         return;
     }
 
-- 
2.13.0



More information about the Spice-devel mailing list