X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvariable.c;h=0b5ca26c977236aff6992806a92a1a5a6adc6bc7;hb=729b96a6bd9342c45e6f65a113fd87c70da85b0a;hp=c0767d7ce245bcfdbcec0b25080228d7c9a38dbc;hpb=04d2c99833753252b724dd9d4f15cc3a80b6bec8;p=pspp-builds.git diff --git a/src/data/variable.c b/src/data/variable.c index c0767d7c..0b5ca26c 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -149,13 +149,13 @@ var_clone (const struct variable *old_var) return new_var; } -/* Create a variable to be used for internal calculations only. - The variable is assigned a unique dictionary index and a case - index of CASE_IDX. */ +/* Create a variable of the specified WIDTH to be used for + internal calculations only. The variable is assigned a unique + dictionary index and a case index of CASE_IDX. */ struct variable * -var_create_internal (int case_idx) +var_create_internal (int case_idx, int width) { - struct variable *v = var_create ("$internal", 0); + struct variable *v = var_create ("$internal", width); struct vardict_info vdi; static int counter = INT_MAX / 2; @@ -590,10 +590,12 @@ var_append_value_name (const struct variable *v, const union value *value, struct string *str) { const char *name = var_lookup_value_label (v, value); + const struct dictionary *dict = var_get_vardict (v)->dict; if (name == NULL) { - char *s = ds_put_uninit (str, v->print.w); - data_out (value, &v->print, s); + char *s = data_out (value, dict_get_encoding (dict), &v->print); + ds_put_cstr (str, s); + free (s); } else ds_put_cstr (str, name);