From: Ben Pfaff Date: Mon, 2 Sep 2019 06:27:11 +0000 (+0000) Subject: variable: Make var_append_value_name() omit trailing white space. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2053ecc53ff35591cdba70cf20d43d16ad680367;p=pspp variable: Make var_append_value_name() omit trailing white space. This seems to be desirable in the cases where it's actually used. It only affects one test case in the current testsuite, but it's an improvement for an upcoming change too. --- diff --git a/src/data/variable.c b/src/data/variable.c index 25b3228de3..6f4a7964a4 100644 --- a/src/data/variable.c +++ b/src/data/variable.c @@ -558,7 +558,9 @@ 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); } diff --git a/tests/language/stats/means.at b/tests/language/stats/means.at index eda5fef177..72f98b3d1f 100644 --- a/tests/language/stats/means.at +++ b/tests/language/stats/means.at @@ -441,36 +441,36 @@ score * a * b * c,9,100.0%,0,.0%,9,100.0% Table: Report a,b,c,Mean,N,Std. Deviation -fooberrycrumblexzaQ ,fosilationwereqd,one ,4.00,1,NaN -,,two ,41.00,1,NaN -,,zero ,3.00,1,NaN +fooberrycrumblexzaQ,fosilationwereqd,one,4.00,1,NaN +,,two,41.00,1,NaN +,,zero,3.00,1,NaN ,,Total,16.00,3,21.66 -,onlyonekonboys ,one ,6.00,1,NaN -,,zero ,5.00,1,NaN +,onlyonekonboys,one,6.00,1,NaN +,,zero,5.00,1,NaN ,,Total,5.50,2,.71 -,Total,one ,5.00,2,1.41 -,,two ,41.00,1,NaN -,,zero ,4.00,2,1.41 +,Total,one,5.00,2,1.41 +,,two,41.00,1,NaN +,,zero,4.00,2,1.41 ,,Total,11.80,5,16.36 -wontledingbatsXASDF ,fosilationwereqd,one ,8.00,1,NaN -,,zero ,7.00,1,NaN +wontledingbatsXASDF,fosilationwereqd,one,8.00,1,NaN +,,zero,7.00,1,NaN ,,Total,7.50,2,.71 -,onlyonekonboys ,one ,10.00,1,NaN -,,zero ,9.00,1,NaN +,onlyonekonboys,one,10.00,1,NaN +,,zero,9.00,1,NaN ,,Total,9.50,2,.71 -,Total,one ,9.00,2,1.41 -,,zero ,8.00,2,1.41 +,Total,one,9.00,2,1.41 +,,zero,8.00,2,1.41 ,,Total,8.50,4,1.29 -Total,fosilationwereqd,one ,6.00,2,2.83 -,,two ,41.00,1,NaN -,,zero ,5.00,2,2.83 +Total,fosilationwereqd,one,6.00,2,2.83 +,,two,41.00,1,NaN +,,zero,5.00,2,2.83 ,,Total,12.60,5,16.01 -,onlyonekonboys ,one ,8.00,2,2.83 -,,zero ,7.00,2,2.83 +,onlyonekonboys,one,8.00,2,2.83 +,,zero,7.00,2,2.83 ,,Total,7.50,4,2.38 -,Total,one ,7.00,4,2.58 -,,two ,41.00,1,NaN -,,zero ,6.00,4,2.58 +,Total,one,7.00,4,2.58 +,,two,41.00,1,NaN +,,zero,6.00,4,2.58 ,,Total,10.33,9,11.73 ])