[gnumeric] CRONBACH: Simplify.



commit 8b65af96db34ad2533fe40d69f8c577d5ebb82f6
Author: Morten Welinder <terra gnome org>
Date:   Fri Dec 29 12:44:59 2017 -0500

    CRONBACH: Simplify.
    
    Use the WANT_REF flag instead of trying to deal with single cell refs
    by hand.  The simplified code correctly handles deps and also makes
    the reference absolute for free.

 plugins/fn-stat/ChangeLog   |    4 ++++
 plugins/fn-stat/functions.c |   26 ++++++--------------------
 2 files changed, 10 insertions(+), 20 deletions(-)
---
diff --git a/plugins/fn-stat/ChangeLog b/plugins/fn-stat/ChangeLog
index edb7dfa..3430128 100644
--- a/plugins/fn-stat/ChangeLog
+++ b/plugins/fn-stat/ChangeLog
@@ -1,3 +1,7 @@
+2017-12-29  Morten Welinder  <terra gnome org>
+
+       * functions.c (function_marshal_arg): Simplify.
+
 2017-12-28  Morten Welinder <terra gnome org>
 
        * Release 1.12.38
diff --git a/plugins/fn-stat/functions.c b/plugins/fn-stat/functions.c
index c477a64..abf0245 100644
--- a/plugins/fn-stat/functions.c
+++ b/plugins/fn-stat/functions.c
@@ -33,7 +33,6 @@
 #include <gutils.h>
 #include <value.h>
 #include <expr.h>
-#include <expr-impl.h>
 #include <gnm-i18n.h>
 #include <goffice/goffice.h>
 #include <gnm-plugin.h>
@@ -4664,27 +4663,14 @@ function_marshal_arg (GnmFuncEvalInfo *ei,
                      GnmExpr const *t,
                      GnmValue **type_mismatch)
 {
-       GnmValue *v;
-
-       *type_mismatch = NULL;
-
-       if (GNM_EXPR_GET_OPER (t) == GNM_EXPR_OP_CELLREF)
-               v = value_new_cellrange (&t->cellref.ref, &t->cellref.ref,
-                                        ei->pos->eval.col,
-                                        ei->pos->eval.row);
-       else
-               v = gnm_expr_eval (t, ei->pos, GNM_EXPR_EVAL_PERMIT_NON_SCALAR);
+       GnmValue *v = gnm_expr_eval (t, ei->pos,
+                                    GNM_EXPR_EVAL_PERMIT_NON_SCALAR |
+                                    GNM_EXPR_EVAL_WANT_REF);
 
-       if (!VALUE_IS_ARRAY (v) && !VALUE_IS_CELLRANGE (v)) {
+       if (!VALUE_IS_ARRAY (v) && !VALUE_IS_CELLRANGE (v))
                *type_mismatch = value_new_error_VALUE (ei->pos);
-       }
-
-       if (VALUE_IS_CELLRANGE (v)) {
-               gnm_cellref_make_abs (&v->v_range.cell.a, &v->v_range.cell.a,
-                       ei->pos);
-               gnm_cellref_make_abs (&v->v_range.cell.b, &v->v_range.cell.b,
-                       ei->pos);
-       }
+       else
+               *type_mismatch = NULL;
 
        return v;
 }


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