value: Get rid of value_str(), value_str_rw(), value_num().
[pspp] / perl-module / PSPP.xs
index 909ffe9e5324a500ff833f09d2e11a39e22d89af..ba43fa58a8b33f22e1e1c356a8cb42ccced5f65a 100644 (file)
@@ -17,6 +17,7 @@
    02110-1301, USA. */
 
 
+#undef VERSION
 #include <config.h>
 
 /* The Gnulib "strftime" module defines my_strftime in <config.h> for use by
@@ -140,7 +141,7 @@ scalar_to_value (union value *val, SV *scalar, const struct variable *var)
        const char *p = SvPV (scalar, len);
        int width = var_get_width (var);
        value_set_missing (val, width);
-       memcpy (value_str_rw (val, width), p, len);
+       memcpy (val->s, p, len);
     }
 }
 
@@ -158,7 +159,7 @@ value_to_scalar (const union value *val, const struct variable *var)
   else
     {
       int width = var_get_width (var);
-      return newSVpvn (value_str (val, width), width);
+      return newSVpvn (val->s, width);
     }
 }
 
@@ -273,7 +274,7 @@ CODE:
         free (input_format);
        }
      hmap_destroy (&dict->input_formats);
-     dict_destroy (dict->dict);
+     dict_unref (dict->dict);
      free (dict);
    }
 
@@ -411,12 +412,15 @@ INIT:
   croak ("No more than 3 missing values are permitted");
 
  for (i = 0; i < items - 1; ++i)
-   scalar_to_value (&val[i], ST(i+1), var);
+   make_value_from_scalar (&val[i], ST(i+1), var);
 CODE:
  struct missing_values mv;
  mv_init (&mv, var_get_width (var));
  for (i = 0 ; i < items - 1; ++i )
-   mv_add_value (&mv, &val[i]);
+   {
+     mv_add_value (&mv, &val[i]);
+     value_destroy (&val[i], var_get_width (var));
+   }
  var_set_missing_values (var, &mv);
 
 
@@ -588,7 +592,6 @@ get_value_labels (var)
 CODE:
  HV *labelhash = (HV *) sv_2mortal ((SV *) newHV());
  const struct val_lab *vl;
- struct val_labs_iterator *viter = NULL;
  const struct val_labs *labels = var_get_value_labels (var);
 
  if ( labels )
@@ -751,7 +754,6 @@ struct sysreader_info *
 pxs_open_sysfile (name)
  char * name
 CODE:
- struct casereader *reader;
  struct sysreader_info *sri = NULL;
  struct file_handle *fh =
    fh_create_file (NULL, name, "UTF-8", fh_default_properties () );