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: move definition of bufsize from heade...



details:   https://anonhg.NetBSD.org/src/rev/c692b09cecef
branches:  trunk
changeset: 988625:c692b09cecef
user:      rillig <rillig%NetBSD.org@localhost>
date:      Thu Oct 07 23:01:32 2021 +0000

description:
indent: move definition of bufsize from header to implementation

No functional change.

diffstat:

 usr.bin/indent/indent.c       |  9 +++++----
 usr.bin/indent/indent_globs.h |  3 +--
 2 files changed, 6 insertions(+), 6 deletions(-)

diffs (51 lines):

diff -r fcab5902c9e1 -r c692b09cecef usr.bin/indent/indent.c
--- a/usr.bin/indent/indent.c   Thu Oct 07 22:56:49 2021 +0000
+++ b/usr.bin/indent/indent.c   Thu Oct 07 23:01:32 2021 +0000
@@ -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 @@
 
 #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 @@
 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
diff -r fcab5902c9e1 -r c692b09cecef usr.bin/indent/indent_globs.h
--- a/usr.bin/indent/indent_globs.h     Thu Oct 07 22:56:49 2021 +0000
+++ b/usr.bin/indent/indent_globs.h     Thu Oct 07 23:01:32 2021 +0000
@@ -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 */



Home | Main Index | Thread Index | Old Index