Consistently use the return value from case_ref.
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 3 Oct 2010 08:41:36 +0000 (10:41 +0200)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 3 Oct 2010 08:41:36 +0000 (10:41 +0200)
This makes debugging easier.

src/data/casegrouper.c
src/math/order-stats.c
src/ui/gui/psppire-data-store.c

index 8d0b081280f0e6a312b4c58c717b1bf3cbbad171..dee1488e9e297145f22782518dd16887315c389e 100644 (file)
@@ -91,8 +91,8 @@ casegrouper_get_next_group (struct casegrouper *grouper,
 
       writer = autopaging_writer_create (
         casereader_get_proto (grouper->reader));
-      case_ref (group_case);
-      casewriter_write (writer, group_case);
+
+      casewriter_write (writer, case_ref (group_case));
 
       while ((tmp = casereader_peek (grouper->reader, 0)) != NULL
              && grouper->same_group (group_case, tmp, grouper->aux))
index e550d2b2eb55f66fd4baea366e7a058abb849443..9f54e8730c9bfda7ce738b5311df3016f3c9cdbf 100644 (file)
@@ -131,8 +131,6 @@ order_stats_accumulate (struct order_stats **os, size_t nos,
       if ( var_is_value_missing (var, case_data (cx, var), exclude))
        continue;
 
-      case_unref (prev_cx);
-
       if ( prev_value == -DBL_MAX || prev_value == this_value)
        c_i += weight;
 
@@ -142,6 +140,7 @@ order_stats_accumulate (struct order_stats **os, size_t nos,
          c_i = weight;
        }
 
+      case_unref (prev_cx);
       cc_i += weight;
       prev_value = this_value;
       prev_cx = case_ref (cx);
index 7deb1022868ac4e548e9773d1dd236bd1c3e60b0..9b1b26a21748a41ad1b203d182dc370f96bf9327 100644 (file)
@@ -879,7 +879,7 @@ psppire_data_store_insert_case (PsppireDataStore *ds,
   g_return_val_if_fail (ds, FALSE);
   g_return_val_if_fail (ds->datasheet, FALSE);
 
-  case_ref (cc);
+  cc = case_ref (cc);
   result = datasheet_insert_rows (ds->datasheet, posn, &cc, 1);
 
   if ( result )