Added some test files, which I'd forgotten about.
[pspp] / src / val-labs.c
index 9d05e77f83c528a067f300bb2d0c384b029f3b58..12817700dabab5b03b6d4367440e4afe1a0f7fd3 100644 (file)
@@ -79,12 +79,15 @@ do_value_labels (int erase)
           goto lossage;
 
       if (token != '/')
+       {
+       free (vars);
        break;
+       }
+
       lex_get ();
 
       free (vars);
     }
-  free (vars);
 
   if (token != '.')
     {
@@ -110,7 +113,7 @@ verify_val_labs (struct variable **vars, int var_cnt)
     {
       struct variable *vp = vars[i];
 
-      if (vp->type == ALPHA && vp->width > 8)
+      if (vp->type == ALPHA && vp->width > MAX_SHORT_STRING)
        {
          msg (SE, _("It is not possible to assign value labels to long "
                     "string variables such as %s."), vp->name);
@@ -151,16 +154,16 @@ get_label (struct variable **vars, int var_cnt)
               lex_error (_("expecting string"));
              return 0;
            }
-         st_bare_pad_copy (value.s, ds_value (&tokstr), MAX_SHORT_STRING);
+         st_bare_pad_copy (value.s, ds_c_str (&tokstr), MAX_SHORT_STRING);
        }
       else
        {
-         if (token != T_NUM)
+         if (!lex_is_number ())
            {
              lex_error (_("expecting integer"));
              return 0;
            }
-         if (!lex_integer_p ())
+         if (!lex_is_integer ())
            msg (SW, _("Value label `%g' is not integer."), tokval);
          value.f = tokval;
        }
@@ -174,7 +177,7 @@ get_label (struct variable **vars, int var_cnt)
          msg (SW, _("Truncating value label to 60 characters."));
          ds_truncate (&tokstr, 60);
        }
-      label = ds_value (&tokstr);
+      label = ds_c_str (&tokstr);
 
       for (i = 0; i < var_cnt; i++)
         val_labs_replace (vars[i]->val_labs, value, label);