X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fdata%2Fvariable.c;h=3ad9eccdb07c05548d4bc87664ff35d1e191b1e9;hb=3bf92c99a566c03d4100ada7e83cafac7219c4fb;hp=25b3228de345fb1399440586c85059bb77be9358;hpb=5cab4cf3322f29c0ed7134d23740e07382914f20;p=pspp diff --git a/src/data/variable.c b/src/data/variable.c index 25b3228de3..3ad9eccdb0 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -558,22 +558,19 @@ append_value (const struct variable *v, const union value *value, struct string *str) { char *s = data_out (value, var_get_encoding (v), &v->print); - ds_put_cstr (str, s); + struct substring ss = ss_cstr (s); + ss_rtrim (&ss, ss_cstr (" ")); + ds_put_substring (str, ss); free (s); } -/* Append STR with a string representing VALUE for variable V. - That is, if VALUE has a label, append that label, - otherwise format VALUE and append the formatted string. - STR must be a pointer to an initialised struct string. -*/ void -var_append_value_name (const struct variable *v, const union value *value, - struct string *str) +var_append_value_name__ (const struct variable *v, const union value *value, + enum settings_value_show show, struct string *str) { const char *label = var_lookup_value_label (v, value); - switch (settings_get_show_values ()) + switch (show) { case SETTINGS_VALUE_SHOW_VALUE: append_value (v, value, str); @@ -594,6 +591,18 @@ var_append_value_name (const struct variable *v, const union value *value, break; } } + +/* Append STR with a string representing VALUE for variable V. + That is, if VALUE has a label, append that label, + otherwise format VALUE and append the formatted string. + STR must be a pointer to an initialised struct string. +*/ +void +var_append_value_name (const struct variable *v, const union value *value, + struct string *str) +{ + var_append_value_name__ (v, value, settings_get_show_values (), str); +} /* Print and write formats. */