indent: use consistent array indexing

No functional change.
This commit is contained in:
rillig 2021-03-11 22:15:44 +00:00
parent a855cd0537
commit 72f722fd46
2 changed files with 7 additions and 7 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: lexi.c,v 1.32 2021/03/11 21:47:36 rillig Exp $ */
/* $NetBSD: lexi.c,v 1.33 2021/03/11 22:15:44 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@ -46,7 +46,7 @@ static char sccsid[] = "@(#)lexi.c 8.1 (Berkeley) 6/6/93";
#include <sys/cdefs.h>
#ifndef lint
#if defined(__NetBSD__)
__RCSID("$NetBSD: lexi.c,v 1.32 2021/03/11 21:47:36 rillig Exp $");
__RCSID("$NetBSD: lexi.c,v 1.33 2021/03/11 22:15:44 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
#endif
@ -331,7 +331,7 @@ lexi(struct parser_state *state)
*buf_ptr == '_' || *buf_ptr == '$') {
/* fill_buffer() terminates buffer with newline */
if (*buf_ptr == '\\') {
if (*(buf_ptr + 1) == '\n') {
if (buf_ptr[1] == '\n') {
buf_ptr += 2;
if (buf_ptr >= buf_end)
fill_buffer();
@ -650,7 +650,7 @@ stop_lit:
unary_delim = state->last_u_d;
break;
}
while (*(e_token - 1) == *buf_ptr || *buf_ptr == '=') {
while (e_token[-1] == *buf_ptr || *buf_ptr == '=') {
/*
* handle ||, &&, etc, and also things as in int *****i
*/

View File

@ -1,4 +1,4 @@
/* $NetBSD: pr_comment.c,v 1.15 2021/03/09 16:48:28 rillig Exp $ */
/* $NetBSD: pr_comment.c,v 1.16 2021/03/11 22:15:44 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@ -46,7 +46,7 @@ static char sccsid[] = "@(#)pr_comment.c 8.1 (Berkeley) 6/6/93";
#include <sys/cdefs.h>
#ifndef lint
#if defined(__NetBSD__)
__RCSID("$NetBSD: pr_comment.c,v 1.15 2021/03/09 16:48:28 rillig Exp $");
__RCSID("$NetBSD: pr_comment.c,v 1.16 2021/03/11 22:15:44 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@ -283,7 +283,7 @@ pr_comment(void)
}
else {
ps.last_nl = 1;
if (*(e_com - 1) == ' ' || *(e_com - 1) == '\t')
if (e_com[-1] == ' ' || e_com[-1] == '\t')
last_bl = e_com - 1;
/*
* if there was a space at the end of the last line, remember