subcase: Rename subcase_destroy() to subcase_uninit().
[pspp] / src / language / stats / runs.c
index f5c9979169b9b79ba1ac3ae00a6e47508c20b360..8a63b29c96b8e43a582267571e7adaad68e048f7 100644 (file)
@@ -116,7 +116,7 @@ runs_execute (const struct dataset *ds,
 
   struct one_sample_test *otp = UP_CAST (test, struct one_sample_test, parent);
   struct runs_test *rt = UP_CAST (otp, struct runs_test, parent);
-  struct run_state *rs = xcalloc (otp->n_vars, sizeof (*rs));
+  struct run_state *rs = XCALLOC (otp->n_vars,  struct run_state);
 
   switch  (rt->cp_mode)
     {
@@ -143,9 +143,9 @@ runs_execute (const struct dataset *ds,
                struct ccase *c;
                for (; (c = casereader_read (group)); case_unref (c))
                  {
-                   const double w = weight ? case_data (c, weight)->f: 1.0;
+                   const double w = weight ? case_num (c, weight) : 1.0;
                    const union value *val = case_data (c, var);
-                   if (var_is_value_missing (var, val, exclude))
+                   if (var_is_value_missing (var, val) & exclude)
                      continue;
                    x = val->f;
                    cc += w;
@@ -191,8 +191,8 @@ runs_execute (const struct dataset *ds,
            for (; (c = casereader_read (reader));)
              {
                const union value *val = case_data (c, var);
-               const double w = weight ? case_data (c, weight)->f: 1.0;
-               if (var_is_value_missing (var, val, exclude))
+               const double w = weight ? case_num (c, weight) : 1.0;
+               if (var_is_value_missing (var, val) & exclude)
                  {
                    case_unref (c);
                    continue;
@@ -201,7 +201,7 @@ runs_execute (const struct dataset *ds,
                cc += w;
                casewriter_write (writer, c);
              }
-           subcase_destroy (&sc);
+           subcase_uninit (&sc);
            casereader_destroy (reader);
            reader = casewriter_make_reader (writer);
 
@@ -224,7 +224,7 @@ runs_execute (const struct dataset *ds,
        struct casereader *reader = casereader_clone (input);
        for (; (c = casereader_read (reader)); case_unref (c))
          {
-           const double w = weight ? case_data (c, weight)->f: 1.0;
+           const double w = weight ? case_num (c, weight) : 1.0;
            for (v = 0; v < otp->n_vars; ++v)
              {
                const struct variable *var = otp->vars[v];
@@ -232,7 +232,7 @@ runs_execute (const struct dataset *ds,
                const double x = val->f;
                struct run_state *run = &rs[v];
 
-               if (var_is_value_missing (var, val, exclude))
+               if (var_is_value_missing (var, val) & exclude)
                  continue;
 
                run->cutpoint += x * w;
@@ -260,7 +260,7 @@ runs_execute (const struct dataset *ds,
 
   for (; (c = casereader_read (input)); case_unref (c))
     {
-      const double w = weight ? case_data (c, weight)->f: 1.0;
+      const double w = weight ? case_num (c, weight) : 1.0;
 
       for (v = 0; v < otp->n_vars; ++v)
        {
@@ -271,7 +271,7 @@ runs_execute (const struct dataset *ds,
          double d = x - run->cutpoint;
          short sign = 0;
 
-         if (var_is_value_missing (var, val, exclude))
+         if (var_is_value_missing (var, val) & exclude)
            continue;
 
          if (d >= 0)