[gnumeric] Code cleanup.



commit 6d9febc4503f6a34a4dbddf7b3f6d3ff717818d5
Author: Morten Welinder <terra gnome org>
Date:   Sun Jan 29 15:21:32 2017 -0500

    Code cleanup.

 ChangeLog              |    5 +++++
 src/style-conditions.c |   44 +++++++++++++++++++++++++++-----------------
 2 files changed, 32 insertions(+), 17 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0237da3..fd37808 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2017-01-29  Morten Welinder  <terra gnome org>
+
+       * src/style-conditions.c (gnm_style_cond_equal): New function.
+       (gnm_style_conditions_equal): ...split out from here.
+
 2017-01-25  Morten Welinder  <terra gnome org>
 
        * src/mstyle.c (ELEM_IS_EQ): Fix last fix.
diff --git a/src/style-conditions.c b/src/style-conditions.c
index 26c7e9b..d6921ad 100644
--- a/src/style-conditions.c
+++ b/src/style-conditions.c
@@ -657,6 +657,30 @@ gnm_style_cond_eval (GnmStyleCond const *cond, GnmValue const *cv,
        return negate ? !res : res;
 }
 
+static gboolean
+gnm_style_cond_equal (GnmStyleCond const *ca, GnmStyleCond const *cb)
+{
+       unsigned oi, N;
+
+       if (ca->op != cb->op)
+               return FALSE;
+
+       if (!gnm_style_equal (ca->overlay, cb->overlay))
+               return FALSE;
+
+       N = gnm_style_cond_op_operands (ca->op);
+       for (oi = 0; oi < N; oi++) {
+               if (ca->deps[oi].sheet != cb->deps[oi].sheet)
+                       return FALSE;
+               if (!gnm_expr_top_equal (ca->deps[oi].texpr,
+                                        cb->deps[oi].texpr))
+                       return FALSE;
+       }
+
+       return TRUE;
+}
+
+
 static void
 gnm_style_conditions_finalize (GObject *obj)
 {
@@ -792,24 +816,10 @@ gnm_style_conditions_equal (GnmStyleConditions const *sca,
                return FALSE;
 
        for (ui = 0; ui < ga->len; ui++) {
-               GnmStyleCond *ca = g_ptr_array_index (ga, ui);
-               GnmStyleCond *cb = g_ptr_array_index (gb, ui);
-               unsigned oi, N;
-
-               if (ca->op != cb->op)
-                       return FALSE;
-
-               if (!gnm_style_equal (ca->overlay, cb->overlay))
+               GnmStyleCond const *ca = g_ptr_array_index (ga, ui);
+               GnmStyleCond const *cb = g_ptr_array_index (gb, ui);
+               if (!gnm_style_cond_equal (ca, cb))
                        return FALSE;
-
-               N = gnm_style_cond_op_operands (ca->op);
-               for (oi = 0; oi < N; oi++) {
-                       if (ca->deps[oi].sheet != cb->deps[oi].sheet)
-                               return FALSE;
-                       if (!gnm_expr_top_equal (ca->deps[oi].texpr,
-                                                cb->deps[oi].texpr))
-                               return FALSE;
-               }
        }
 
        return TRUE;


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