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: use all headers in all files
details: https://anonhg.NetBSD.org/src/rev/fc3ace2011c2
branches: trunk
changeset: 981294:fc3ace2011c2
user: rillig <rillig%NetBSD.org@localhost>
date: Sun Mar 07 10:42:48 2021 +0000
description:
indent: use all headers in all files
This is a prerequisite for converting the token types to an enum instead
of a preprocessor define, since the return type of lexi will become
token_type. Having the enum will make debugging easier.
There was a single naming collision, which forced the variable in
scan_profile to be renamed. All other token names are used nowhere
else.
No change to the resulting binary.
diffstat:
usr.bin/indent/args.c | 22 +++++++++++-----------
usr.bin/indent/indent.c | 7 +++----
usr.bin/indent/indent.h | 7 +++++--
usr.bin/indent/io.c | 6 +++---
usr.bin/indent/lexi.c | 6 ++----
usr.bin/indent/parse.c | 5 ++---
usr.bin/indent/pr_comment.c | 8 ++++----
7 files changed, 30 insertions(+), 31 deletions(-)
diffs (215 lines):
diff -r 5821c0697a9e -r fc3ace2011c2 usr.bin/indent/args.c
--- a/usr.bin/indent/args.c Sun Mar 07 10:42:26 2021 +0000
+++ b/usr.bin/indent/args.c Sun Mar 07 10:42:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: args.c,v 1.14 2019/04/04 15:22:13 kamil Exp $ */
+/* $NetBSD: args.c,v 1.15 2021/03/07 10:42:48 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
#include <sys/cdefs.h>
#ifndef lint
#if defined(__NetBSD__)
-__RCSID("$NetBSD: args.c,v 1.14 2019/04/04 15:22:13 kamil Exp $");
+__RCSID("$NetBSD: args.c,v 1.15 2021/03/07 10:42:48 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/args.c 336318 2018-07-15 21:04:21Z pstef $");
#endif
@@ -63,7 +63,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "indent_globs.h"
+
#include "indent.h"
#define INDENT_VERSION "2.0"
@@ -209,22 +209,22 @@
static void
scan_profile(FILE *f)
{
- int comment, i;
+ int comment_index, i;
char *p;
char buf[BUFSIZ];
while (1) {
p = buf;
- comment = 0;
+ comment_index = 0;
while ((i = getc(f)) != EOF) {
- if (i == '*' && !comment && p > buf && p[-1] == '/') {
- comment = p - buf;
+ if (i == '*' && !comment_index && p > buf && p[-1] == '/') {
+ comment_index = p - buf;
*p++ = i;
- } else if (i == '/' && comment && p > buf && p[-1] == '*') {
- p = buf + comment - 1;
- comment = 0;
+ } else if (i == '/' && comment_index && p > buf && p[-1] == '*') {
+ p = buf + comment_index - 1;
+ comment_index = 0;
} else if (isspace((unsigned char)i)) {
- if (p > buf && !comment)
+ if (p > buf && !comment_index)
break;
} else {
*p++ = i;
diff -r 5821c0697a9e -r fc3ace2011c2 usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c Sun Mar 07 10:42:26 2021 +0000
+++ b/usr.bin/indent/indent.c Sun Mar 07 10:42:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.c,v 1.28 2021/03/06 20:30:06 rillig Exp $ */
+/* $NetBSD: indent.c,v 1.29 2021/03/07 10:42:48 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
#include <sys/cdefs.h>
#ifndef lint
#if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.28 2021/03/06 20:30:06 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.29 2021/03/07 10:42:48 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
#endif
@@ -65,8 +65,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
-#include "indent_globs.h"
-#include "indent_codes.h"
+
#include "indent.h"
struct options opt;
diff -r 5821c0697a9e -r fc3ace2011c2 usr.bin/indent/indent.h
--- a/usr.bin/indent/indent.h Sun Mar 07 10:42:26 2021 +0000
+++ b/usr.bin/indent/indent.h Sun Mar 07 10:42:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: indent.h,v 1.2 2019/10/19 15:44:31 christos Exp $ */
+/* $NetBSD: indent.h,v 1.3 2021/03/07 10:42:48 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-2-Clause-FreeBSD
@@ -30,12 +30,15 @@
#if 0
#if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.h,v 1.2 2019/10/19 15:44:31 christos Exp $");
+__RCSID("$NetBSD: indent.h,v 1.3 2021/03/07 10:42:48 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/indent.h 336333 2018-07-16 05:46:50Z pstef $");
#endif
#endif
+#include "indent_codes.h"
+#include "indent_globs.h"
+
#ifndef nitems
#define nitems(array) (sizeof (array) / sizeof (array[0]))
#endif
diff -r 5821c0697a9e -r fc3ace2011c2 usr.bin/indent/io.c
--- a/usr.bin/indent/io.c Sun Mar 07 10:42:26 2021 +0000
+++ b/usr.bin/indent/io.c Sun Mar 07 10:42:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: io.c,v 1.21 2021/03/06 20:30:06 rillig Exp $ */
+/* $NetBSD: io.c,v 1.22 2021/03/07 10:42:48 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
#include <sys/cdefs.h>
#ifndef lint
#if defined(__NetBSD__)
-__RCSID("$NetBSD: io.c,v 1.21 2021/03/06 20:30:06 rillig Exp $");
+__RCSID("$NetBSD: io.c,v 1.22 2021/03/07 10:42:48 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/io.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -58,7 +58,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
-#include "indent_globs.h"
+
#include "indent.h"
int comment_open;
diff -r 5821c0697a9e -r fc3ace2011c2 usr.bin/indent/lexi.c
--- a/usr.bin/indent/lexi.c Sun Mar 07 10:42:26 2021 +0000
+++ b/usr.bin/indent/lexi.c Sun Mar 07 10:42:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lexi.c,v 1.17 2019/10/19 15:44:31 christos Exp $ */
+/* $NetBSD: lexi.c,v 1.18 2021/03/07 10:42:48 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
#include <sys/cdefs.h>
#ifndef lint
#if defined(__NetBSD__)
-__RCSID("$NetBSD: lexi.c,v 1.17 2019/10/19 15:44:31 christos Exp $");
+__RCSID("$NetBSD: lexi.c,v 1.18 2021/03/07 10:42:48 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/lexi.c 337862 2018-08-15 18:19:45Z pstef $");
#endif
@@ -65,8 +65,6 @@
#include <string.h>
#include <sys/param.h>
-#include "indent_globs.h"
-#include "indent_codes.h"
#include "indent.h"
struct templ {
diff -r 5821c0697a9e -r fc3ace2011c2 usr.bin/indent/parse.c
--- a/usr.bin/indent/parse.c Sun Mar 07 10:42:26 2021 +0000
+++ b/usr.bin/indent/parse.c Sun Mar 07 10:42:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.11 2021/03/06 20:30:06 rillig Exp $ */
+/* $NetBSD: parse.c,v 1.12 2021/03/07 10:42:48 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -54,8 +54,7 @@
#include <err.h>
#include <stdio.h>
-#include "indent_globs.h"
-#include "indent_codes.h"
+
#include "indent.h"
static void reduce(void);
diff -r 5821c0697a9e -r fc3ace2011c2 usr.bin/indent/pr_comment.c
--- a/usr.bin/indent/pr_comment.c Sun Mar 07 10:42:26 2021 +0000
+++ b/usr.bin/indent/pr_comment.c Sun Mar 07 10:42:48 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: pr_comment.c,v 1.11 2019/04/04 15:22:13 kamil Exp $ */
+/* $NetBSD: pr_comment.c,v 1.12 2021/03/07 10:42:48 rillig Exp $ */
/*-
* SPDX-License-Identifier: BSD-4-Clause
@@ -46,7 +46,7 @@
#include <sys/cdefs.h>
#ifndef lint
#if defined(__NetBSD__)
-__RCSID("$NetBSD: pr_comment.c,v 1.11 2019/04/04 15:22:13 kamil Exp $");
+__RCSID("$NetBSD: pr_comment.c,v 1.12 2021/03/07 10:42:48 rillig Exp $");
#elif defined(__FreeBSD__)
__FBSDID("$FreeBSD: head/usr.bin/indent/pr_comment.c 334927 2018-06-10 16:44:18Z pstef $");
#endif
@@ -56,9 +56,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "indent_globs.h"
-#include "indent_codes.h"
+
#include "indent.h"
+
/*
* NAME:
* pr_comment
Home |
Main Index |
Thread Index |
Old Index