Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make: inline Buf_Clear



details:   https://anonhg.NetBSD.org/src/rev/939e01961fa0
branches:  trunk
changeset: 359523:939e01961fa0
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Jan 08 17:25:19 2022 +0000

description:
make: inline Buf_Clear

No functional change.

diffstat:

 usr.bin/make/buf.c |  12 ++----------
 usr.bin/make/buf.h |  11 +++++++++--
 usr.bin/make/for.c |   6 +++---
 usr.bin/make/var.c |   6 +++---
 4 files changed, 17 insertions(+), 18 deletions(-)

diffs (119 lines):

diff -r 1a5a7e1efc88 -r 939e01961fa0 usr.bin/make/buf.c
--- a/usr.bin/make/buf.c        Sat Jan 08 14:28:14 2022 +0000
+++ b/usr.bin/make/buf.c        Sat Jan 08 17:25:19 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buf.c,v 1.54 2021/12/15 09:29:55 rillig Exp $  */
+/*     $NetBSD: buf.c,v 1.55 2022/01/08 17:25:19 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -75,7 +75,7 @@
 #include "make.h"
 
 /*     "@(#)buf.c      8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: buf.c,v 1.54 2021/12/15 09:29:55 rillig Exp $");
+MAKE_RCSID("$NetBSD: buf.c,v 1.55 2022/01/08 17:25:19 rillig Exp $");
 
 /* Make space in the buffer for adding at least 16 more bytes. */
 void
@@ -138,14 +138,6 @@
        }
 }
 
-/* Mark the buffer as empty, so it can be filled with data again. */
-void
-Buf_Empty(Buffer *buf)
-{
-       buf->len = 0;
-       buf->data[0] = '\0';
-}
-
 /* Initialize a buffer. */
 void
 Buf_InitSize(Buffer *buf, size_t cap)
diff -r 1a5a7e1efc88 -r 939e01961fa0 usr.bin/make/buf.h
--- a/usr.bin/make/buf.h        Sat Jan 08 14:28:14 2022 +0000
+++ b/usr.bin/make/buf.h        Sat Jan 08 17:25:19 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: buf.h,v 1.46 2021/12/15 12:08:25 rillig Exp $  */
+/*     $NetBSD: buf.h,v 1.47 2022/01/08 17:25:19 rillig Exp $  */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -88,6 +88,14 @@
 
 void Buf_Expand(Buffer *);
 
+/* Mark the buffer as empty, so it can be filled with data again. */
+MAKE_INLINE void
+Buf_Clear(Buffer *buf)
+{
+       buf->len = 0;
+       buf->data[0] = '\0';
+}
+
 /* Buf_AddByte adds a single byte to a buffer. */
 MAKE_INLINE void
 Buf_AddByte(Buffer *buf, char byte)
@@ -112,7 +120,6 @@
 void Buf_AddStr(Buffer *, const char *);
 void Buf_AddInt(Buffer *, int);
 void Buf_AddFlag(Buffer *, bool, const char *);
-void Buf_Empty(Buffer *);
 void Buf_Init(Buffer *);
 void Buf_InitSize(Buffer *, size_t);
 void Buf_Done(Buffer *);
diff -r 1a5a7e1efc88 -r 939e01961fa0 usr.bin/make/for.c
--- a/usr.bin/make/for.c        Sat Jan 08 14:28:14 2022 +0000
+++ b/usr.bin/make/for.c        Sat Jan 08 17:25:19 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: for.c,v 1.158 2022/01/07 23:13:50 rillig Exp $ */
+/*     $NetBSD: for.c,v 1.159 2022/01/08 17:25:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1992, The Regents of the University of California.
@@ -58,7 +58,7 @@
 #include "make.h"
 
 /*     "@(#)for.c      8.1 (Berkeley) 6/6/93"  */
-MAKE_RCSID("$NetBSD: for.c,v 1.158 2022/01/07 23:13:50 rillig Exp $");
+MAKE_RCSID("$NetBSD: for.c,v 1.159 2022/01/08 17:25:19 rillig Exp $");
 
 
 typedef struct ForLoop {
@@ -429,7 +429,7 @@
        const char *p, *end;
        const char *mark;       /* where the last substitution left off */
 
-       Buf_Empty(body);
+       Buf_Clear(body);
 
        mark = f->body.data;
        end = f->body.data + f->body.len;
diff -r 1a5a7e1efc88 -r 939e01961fa0 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sat Jan 08 14:28:14 2022 +0000
+++ b/usr.bin/make/var.c        Sat Jan 08 17:25:19 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.997 2022/01/08 11:04:13 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.998 2022/01/08 17:25:19 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -140,7 +140,7 @@
 #include "metachar.h"
 
 /*     "@(#)var.c      8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.997 2022/01/08 11:04:13 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.998 2022/01/08 17:25:19 rillig Exp $");
 
 /*
  * Variables are defined using one of the VAR=value assignments.  Their
@@ -999,7 +999,7 @@
                            scope->name, name, val);
                        return;
                }
-               Buf_Empty(&v->val);
+               Buf_Clear(&v->val);
                Buf_AddStr(&v->val, val);
 
                DEBUG3(VAR, "%s: %s = %s\n", scope->name, name, val);



Home | Main Index | Thread Index | Old Index