variable: Make var_append_value_name() omit trailing white space.
authorBen Pfaff <blp@cs.stanford.edu>
Mon, 2 Sep 2019 06:27:11 +0000 (06:27 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Mon, 2 Sep 2019 06:27:11 +0000 (06:27 +0000)
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.

src/data/variable.c
tests/language/stats/means.at

index 25b3228de345fb1399440586c85059bb77be9358..6f4a7964a4069994a1d8f6068aa1b0b385a7d35b 100644 (file)
@@ -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);
 }
 
index eda5fef177a67ad5020a6d54097ed518d19b9c13..72f98b3d1ff8718bccab8d517c55ee58ca9bac2b 100644 (file)
@@ -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
 ])