svn commit: r303489 - head/usr.bin/indent
Pedro F. Giffuni
pfg at FreeBSD.org
Fri Jul 29 16:34:17 UTC 2016
Author: pfg
Date: Fri Jul 29 16:34:16 2016
New Revision: 303489
URL: https://svnweb.freebsd.org/changeset/base/303489
Log:
indent(1): Removed whitespace shouldn't be considered in column calculations.
This piece of code removed tabs and space characters from after colons
that follow labels by decrementing the e_lab (end of label) "pointer"
which is later used to calculate the width of the string that fprintf()
puts into "output". But pad_output() gets the length from the actual
string, so it miscalculated what the current column is.
Fixed by putting a string terminator at the e_lab "pointer".
Differential Revision: https://reviews.freebsd.org/D6966
(Partial)
Obtained from: Piotr Stefaniak
Modified:
head/usr.bin/indent/io.c
Modified: head/usr.bin/indent/io.c
==============================================================================
--- head/usr.bin/indent/io.c Fri Jul 29 16:33:45 2016 (r303488)
+++ head/usr.bin/indent/io.c Fri Jul 29 16:34:16 2016 (r303489)
@@ -116,6 +116,7 @@ dump_line(void)
}
while (e_lab > s_lab && (e_lab[-1] == ' ' || e_lab[-1] == '\t'))
e_lab--;
+ *e_lab = '\0';
cur_col = pad_output(1, compute_label_target());
if (s_lab[0] == '#' && (strncmp(s_lab, "#else", 5) == 0
|| strncmp(s_lab, "#endif", 6) == 0)) {
More information about the svn-src-all
mailing list