X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fmdd-writer.c;h=b025e693b4625c572ac08beda09d691206ade99c;hb=refs%2Fheads%2Fctables7;hp=ba69c99cc281a37c23f5116d86f3a0acedcda8a7;hpb=2dd6b5accbbf92ee440e8a3b41ade942e7e41f29;p=pspp
diff --git a/src/data/mdd-writer.c b/src/data/mdd-writer.c
index ba69c99cc2..b025e693b4 100644
--- a/src/data/mdd-writer.c
+++ b/src/data/mdd-writer.c
@@ -122,7 +122,7 @@ all_variables (struct dictionary *dict);
struct all_dict_variables
all_variables (struct dictionary *dict)
{
- size_t n_vars = dict_get_var_cnt (dict);
+ size_t n_vars = dict_get_n_vars (dict);
/* Start with a set of all variable names. */
struct string_set var_names = STRING_SET_INITIALIZER (var_names);
@@ -148,8 +148,8 @@ all_variables (struct dictionary *dict)
size_t var_count = n_sets + string_set_count (&var_names);
/* Allocate an array of var_or_mrset pointers (initially null). */
- struct var_or_mrset *var_or_mrset_array = xcalloc (
- var_count, sizeof *var_or_mrset_array);
+ struct var_or_mrset *var_or_mrset_array
+ = XCALLOC (var_count, struct var_or_mrset);
/* Fill the array. */
struct string_set added_mrsets = STRING_SET_INITIALIZER (added_mrsets);
@@ -288,7 +288,7 @@ write_value_label_value (xmlTextWriter *writer, const struct val_lab *vl,
const union value *value = val_lab_get_value (vl);
if (width)
{
- char *s = xmemdup0 (value_str (value, width), width);
+ char *s = xmemdup0 (value->s, width);
xmlTextWriterWriteAttribute (writer, _xml ("value"), _xml (s));
free (s);
}
@@ -405,10 +405,9 @@ write_variable_section (xmlTextWriter *writer, const struct variable *var, int i
XXX only checking "user" here because not sure of correct other
cases. */
- if (var_is_value_missing (var, value, MV_USER))
- write_attr (writer, "missing", "user");
- else if (var_is_value_missing (var, value, MV_SYSTEM))
- write_attr (writer, "missing", "system");
+ enum mv_class miss = var_is_value_missing (var, value);
+ if (miss)
+ write_attr (writer, "missing", miss == MV_USER ? "user" : "system");
/* */
xmlTextWriterStartElement (writer, _xml ("properties"));
@@ -448,8 +447,8 @@ bool
mdd_write (struct file_handle *fh, struct dictionary *dict,
const char *sav_name)
{
- struct mdd_writer *w = xzalloc (sizeof *w);
- size_t n_vars = dict_get_var_cnt (dict);
+ struct mdd_writer *w = XZALLOC (struct mdd_writer);
+ size_t n_vars = dict_get_n_vars (dict);
/* Open file handle as an exclusive writer. */
/* TRANSLATORS: this fragment will be interpolated into
@@ -470,7 +469,8 @@ mdd_write (struct file_handle *fh, struct dictionary *dict,
w->writer = xmlNewTextWriter (xmlOutputBufferCreateFile (w->file, NULL));
if (!w->writer)
{
- msg (ME, _("Internal error creating xmlTextWriter."));
+ msg (ME, _("Internal error creating xmlTextWriter. "
+ "Please report this to %s."), PACKAGE_BUGREPORT);
goto error;
}
@@ -623,7 +623,7 @@ mdd_write (struct file_handle *fh, struct dictionary *dict,
/* We reserve ids 1...N_VARS for variables and then start other ids after
that. */
- int id = dict_get_var_cnt (dict) + 1;
+ int id = dict_get_n_vars (dict) + 1;
/* */
xmlTextWriterStartElement (w->writer, _xml ("definition"));