Module Name:    src
Committed By:   rillig
Date:           Thu Oct  7 23:01:32 UTC 2021

Modified Files:
        src/usr.bin/indent: indent.c indent_globs.h

Log Message:
indent: move definition of bufsize from header to implementation

No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.122 -r1.123 src/usr.bin/indent/indent.c
cvs rdiff -u -r1.45 -r1.46 src/usr.bin/indent/indent_globs.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/indent/indent.c
diff -u src/usr.bin/indent/indent.c:1.122 src/usr.bin/indent/indent.c:1.123
--- src/usr.bin/indent/indent.c:1.122	Thu Oct  7 22:56:49 2021
+++ src/usr.bin/indent/indent.c	Thu Oct  7 23:01:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent.c,v 1.122 2021/10/07 22:56:49 rillig Exp $	*/
+/*	$NetBSD: indent.c,v 1.123 2021/10/07 23:01:32 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -43,7 +43,7 @@ static char sccsid[] = "@(#)indent.c	5.1
 
 #include <sys/cdefs.h>
 #if defined(__NetBSD__)
-__RCSID("$NetBSD: indent.c,v 1.122 2021/10/07 22:56:49 rillig Exp $");
+__RCSID("$NetBSD: indent.c,v 1.123 2021/10/07 23:01:32 rillig Exp $");
 #elif defined(__FreeBSD__)
 __FBSDID("$FreeBSD: head/usr.bin/indent/indent.c 340138 2018-11-04 19:24:49Z oshogbo $");
 #endif
@@ -366,12 +366,13 @@ search_brace(token_type *ttype, bool *fo
 static void
 buf_init(struct buffer *buf)
 {
-    buf->buf = xmalloc(bufsize);
+    size_t size = 200;
+    buf->buf = xmalloc(size);
     buf->buf[0] = ' ';		/* allow accessing buf->e[-1] */
     buf->buf[1] = '\0';
     buf->s = buf->buf + 1;
     buf->e = buf->s;
-    buf->l = buf->buf + bufsize - 5;	/* safety margin, though unreliable */
+    buf->l = buf->buf + size - 5;	/* safety margin */
 }
 
 static size_t

Index: src/usr.bin/indent/indent_globs.h
diff -u src/usr.bin/indent/indent_globs.h:1.45 src/usr.bin/indent/indent_globs.h:1.46
--- src/usr.bin/indent/indent_globs.h:1.45	Thu Oct  7 22:56:49 2021
+++ src/usr.bin/indent/indent_globs.h	Thu Oct  7 23:01:32 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: indent_globs.h,v 1.45 2021/10/07 22:56:49 rillig Exp $	*/
+/*	$NetBSD: indent_globs.h,v 1.46 2021/10/07 23:01:32 rillig Exp $	*/
 
 /*-
  * SPDX-License-Identifier: BSD-4-Clause
@@ -40,7 +40,6 @@
  * $FreeBSD: head/usr.bin/indent/indent_globs.h 337651 2018-08-11 19:20:06Z pstef $
  */
 
-#define bufsize 200		/* size of internal buffers */
 #define sc_size 5000		/* size of save_com buffer */
 #define label_offset 2		/* number of levels a label is placed to left
 				 * of code */

Reply via email to