[gnumeric] GnmFilter: add preconditions.



commit b7ecaf941bd1307e665e193acdb10a32d8c2e053
Author: Morten Welinder <terra gnome org>
Date:   Mon Mar 10 13:58:13 2014 -0400

    GnmFilter: add preconditions.

 ChangeLog          |    5 +++++
 src/sheet-filter.c |   13 +++++++++++--
 2 files changed, 16 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4c60018..397ebdf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-03-10  Morten Welinder  <terra gnome org>
+
+       * src/sheet-filter.c (gnm_filter_condition_new_single)
+       (gnm_filter_condition_new_double): Add preconditions.
+
 2014-03-07  Morten Welinder  <terra gnome org>
 
        * src/wbc-gtk.c (cb_adjust_foreground_attributes): Fix warning.
diff --git a/src/sheet-filter.c b/src/sheet-filter.c
index fd8eead..c9944cf 100644
--- a/src/sheet-filter.c
+++ b/src/sheet-filter.c
@@ -55,7 +55,11 @@
 GnmFilterCondition *
 gnm_filter_condition_new_single (GnmFilterOp op, GnmValue *v)
 {
-       GnmFilterCondition *res = g_new0 (GnmFilterCondition, 1);
+       GnmFilterCondition *res;
+
+       g_return_val_if_fail (v != NULL, NULL);
+
+       res = g_new0 (GnmFilterCondition, 1);
        res->op[0] = op;        res->op[1] = GNM_FILTER_UNUSED;
        res->value[0] = v;
        return res;
@@ -77,7 +81,12 @@ gnm_filter_condition_new_double (GnmFilterOp op0, GnmValue *v0,
                                 gboolean join_with_and,
                                 GnmFilterOp op1, GnmValue *v1)
 {
-       GnmFilterCondition *res = g_new0 (GnmFilterCondition, 1);
+       GnmFilterCondition *res;
+
+       g_return_val_if_fail (v0 != NULL, NULL);
+       g_return_val_if_fail (v1 != NULL, NULL);
+
+       res = g_new0 (GnmFilterCondition, 1);
        res->op[0] = op0;       res->op[1] = op1;
        res->is_and = join_with_and;
        res->value[0] = v0;     res->value[1] = v1;


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