variable-parser: Implement PV_NO_DUPLICATE.
[pspp] / src / language / dictionary / rename-variables.c
index 9f2c96e78331c6e5c8b5457c23863f2b74a3cdd2..c175831d8dacb6c3d448ac2821a9d7362725e1b5 100644 (file)
@@ -1,5 +1,5 @@
 /* PSPP - a program for statistical analysis.
-   Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
+   Copyright (C) 1997-9, 2000, 2010 Free Software Foundation, Inc.
 
    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
 #include <language/command.h>
 #include <language/lexer/lexer.h>
 #include <language/lexer/variable-parser.h>
-#include <libpspp/alloc.h>
 #include <libpspp/hash.h>
 #include <libpspp/message.h>
 #include <libpspp/str.h>
 
+#include "xalloc.h"
+
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
 
@@ -66,16 +67,16 @@ cmd_rename_variables (struct lexer *lexer, struct dataset *ds)
          msg (SE, _("`=' expected between lists of new and old variable names."));
          goto lossage;
        }
-      if (!parse_DATA_LIST_vars (lexer, &rename_new_names, &prev_nv_1, PV_APPEND))
+      if (!parse_DATA_LIST_vars (lexer, &rename_new_names, &prev_nv_1,
+                                 PV_APPEND | PV_NO_DUPLICATE))
        goto lossage;
       if (prev_nv_1 != rename_cnt)
        {
           size_t i;
 
          msg (SE, _("Differing number of variables in old name list "
-                     "(%d) and in new name list (%d)."),
-              (int) (rename_cnt - prev_nv_2),
-               (int) (prev_nv_1 - prev_nv_2));
+                     "(%zu) and in new name list (%zu)."),
+              rename_cnt - prev_nv_2, prev_nv_1 - prev_nv_2);
          for (i = 0; i < prev_nv_1; i++)
            free (rename_new_names[i]);
          free (rename_new_names);