Changed a lot of ints to bools.
[pspp-builds.git] / src / language / dictionary / modify-variables.c
index c17bb5629a3eeea4afd164b9ec0718ab45a7c0ad..333f77045527ef2328f3a24315b38062cf39f50f 100644 (file)
@@ -28,6 +28,7 @@
 #include <language/lexer/lexer.h>
 #include <language/lexer/variable-parser.h>
 #include <libpspp/alloc.h>
+#include <libpspp/assertion.h>
 #include <libpspp/array.h>
 #include <libpspp/bit-vector.h>
 #include <libpspp/compiler.h>
@@ -72,7 +73,7 @@ struct var_modification
     size_t rename_cnt;
   };
 
-static int rearrange_dict (struct dictionary *d,
+static bool rearrange_dict (struct dictionary *d,
                            const struct var_modification *vm);
 
 /* Performs MODIFY VARS command. */
@@ -259,7 +260,7 @@ cmd_modify_vars (void)
                               compare_variables_given_ordering,
                               &forward_positional_ordering)
               != drop_cnt)
-            assert (0);
+            NOT_REACHED ();
 
           free (keep_vars);
           free (all_vars);
@@ -420,7 +421,7 @@ validate_var_modification (const struct dictionary *d,
                       keep_vars,
                       compare_variables_given_ordering,
                       &forward_positional_ordering) != keep_cnt)
-    assert (0);
+    NOT_REACHED ();
 
   /* Copy variables into var_renaming array. */
   var_renaming = xnmalloc (keep_cnt, sizeof *var_renaming);
@@ -465,11 +466,11 @@ validate_var_modification (const struct dictionary *d,
 }
 
 /* Reoders, removes, and renames variables in dictionary D
-   according to VM.  Returns nonzero if successful, zero if there
+   according to VM.  Returns true if successful, false if there
    would have been duplicate variable names if the modifications
    had been carried out.  In the latter case, the dictionary is
    not modified. */
-static int
+static bool
 rearrange_dict (struct dictionary *d, const struct var_modification *vm)
 {
   char **rename_old_names;
@@ -483,7 +484,7 @@ rearrange_dict (struct dictionary *d, const struct var_modification *vm)
   /* Check whether the modifications will cause duplicate
      names. */
   if (!validate_var_modification (d, vm))
-    return 0;
+    return false;
 
   /* Record the old names of variables to rename.  After
      variables are deleted, we can't depend on the variables to
@@ -514,7 +515,7 @@ rearrange_dict (struct dictionary *d, const struct var_modification *vm)
   /* Do renaming. */
   if (dict_rename_vars (d, rename_vars, rename_new_names, rename_cnt,
                         NULL) == 0)
-    assert (0);
+    NOT_REACHED ();
 
   /* Clean up. */
   for (i = 0; i < vm->rename_cnt; i++)
@@ -523,5 +524,5 @@ rearrange_dict (struct dictionary *d, const struct var_modification *vm)
   free (rename_vars);
   free (rename_new_names);
 
-  return 1;
+  return true;
 }