Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/indent indent: fix off-by-one error for indented fir...
details: https://anonhg.NetBSD.org/src/rev/6ec55af9b32a
branches: trunk
changeset: 988251:6ec55af9b32a
user: rillig <rillig%NetBSD.org@localhost>
date: Tue Oct 05 17:14:45 2021 +0000
description:
indent: fix off-by-one error for indented first line
diffstat:
tests/usr.bin/indent/ps_ind_level.0.stdout | 9 ++++-----
usr.bin/indent/indent.c | 6 +++---
2 files changed, 7 insertions(+), 8 deletions(-)
diffs (44 lines):
diff -r 3e73b528cf1b -r 6ec55af9b32a tests/usr.bin/indent/ps_ind_level.0.stdout
--- a/tests/usr.bin/indent/ps_ind_level.0.stdout Tue Oct 05 17:12:20 2021 +0000
+++ b/tests/usr.bin/indent/ps_ind_level.0.stdout Tue Oct 05 17:14:45 2021 +0000
@@ -1,9 +1,8 @@
-/* $NetBSD: ps_ind_level.0.stdout,v 1.1 2021/10/05 17:09:45 rillig Exp $ */
+/* $NetBSD: ps_ind_level.0.stdout,v 1.2 2021/10/05 17:14:45 rillig Exp $ */
/* $FreeBSD$ */
/* $ */
-/* $ FIXME: indentation should be 20 instead of 25. */
- int declaration_in_column_25;
+ int declaration_in_column_25;
/* $ FIXME: The space between '){' is missing. */
- void function_in_column_1(void){
- }
+ void function_in_column_1(void){
+ }
diff -r 3e73b528cf1b -r 6ec55af9b32a usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c Tue Oct 05 17:12:20 2021 +0000
+++ b/usr.bin/indent/indent.c Tue Oct 05 17:14:45 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.106 2021/10/05 17:12:20 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.107 2021/10/05 17:14:45 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@
#include <sys/cdefs.h>
#if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.106 2021/10/05 17:12:20 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.107 2021/10/05 17:14:45 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
#endif
@@ -513,7 +513,7 @@
p++;
}
if (ind >= opt.indent_size)
- ps.ind_level = ps.ind_level_follow = (ind + 1) / opt.indent_size;
+ ps.ind_level = ps.ind_level_follow = ind / opt.indent_size;
}
static void __attribute__((__noreturn__))
Home |
Main Index |
Thread Index |
Old Index