Encapsulated the static data of procedure.[ch] into a single object, to be
[pspp-builds.git] / src / language / dictionary / variable-label.c
index acf5f054e52359f16ca4a10d67f6348867659461..63d64ef5bc58df7f5c12dc8f1628226b537298cd 100644 (file)
    02110-1301, USA. */
 
 #include <config.h>
+
 #include <stdio.h>
 #include <stdlib.h>
-#include <libpspp/alloc.h>
+
+#include <data/procedure.h>
+#include <data/variable.h>
 #include <language/command.h>
-#include <libpspp/message.h>
 #include <language/lexer/lexer.h>
+#include <language/lexer/variable-parser.h>
+#include <libpspp/alloc.h>
+#include <libpspp/message.h>
 #include <libpspp/str.h>
-#include <data/variable.h>
 
 #include "gettext.h"
 #define _(msgid) gettext (msgid)
@@ -40,14 +44,14 @@ cmd_variable_labels (void)
 
       size_t i;
 
-      if (!parse_variables (default_dict, &v, &nv, PV_NONE))
-        return CMD_PART_SUCCESS_MAYBE;
+      if (!parse_variables (dataset_dict (current_dataset), &v, &nv, PV_NONE))
+        return CMD_FAILURE;
 
       if (token != T_STRING)
        {
          msg (SE, _("String expected for variable label."));
          free (v);
-         return CMD_PART_SUCCESS_MAYBE;
+         return CMD_FAILURE;
        }
       if (ds_length (&tokstr) > 255)
        {
@@ -58,7 +62,7 @@ cmd_variable_labels (void)
        {
          if (v[i]->label)
            free (v[i]->label);
-         v[i]->label = xstrdup (ds_c_str (&tokstr));
+         v[i]->label = ds_xstrdup (&tokstr);
        }
 
       lex_get ();