lexer: Factor out scan error messages into new function.
[pspp] / src / language / dictionary / modify-variables.c
index 3dbbc18a02bd2e1b15142f333aa68d8bcf7959ba..ab73bbb8990d7ded61c0701988b07c47f24b3873 100644 (file)
@@ -26,7 +26,6 @@
 #include "language/lexer/variable-parser.h"
 #include "libpspp/array.h"
 #include "libpspp/assertion.h"
-#include "libpspp/bit-vector.h"
 #include "libpspp/compiler.h"
 #include "libpspp/i18n.h"
 #include "libpspp/message.h"
@@ -296,7 +295,7 @@ cmd_modify_vars (struct lexer *lexer, struct dataset *ds)
                          "not be given in conjunction with the %s "
                          "subcommand."),
                   "DROP", "KEEP"
-                  );
+               );
              goto done;
            }
          already_encountered |= 4;
@@ -361,8 +360,9 @@ cmd_modify_vars (struct lexer *lexer, struct dataset *ds)
 done:
   free (vm.reorder_vars);
   free (vm.rename_vars);
-  for (size_t i = 0; i < vm.n_rename; i++)
-    free (vm.new_names[i]);
+  if (vm.new_names)
+    for (size_t i = 0; i < vm.n_rename; i++)
+      free (vm.new_names[i]);
   free (vm.new_names);
   free (vm.drop_vars);
   return ret_code;