diff options
| author | rillig <rillig@NetBSD.org> | 2022-01-08 17:25:19 +0000 |
|---|---|---|
| committer | rillig <rillig@NetBSD.org> | 2022-01-08 17:25:19 +0000 |
| commit | bccc544ed43ca20846f398210d4e53147bb7d79b (patch) | |
| tree | c90c8c6ceedd958d2dacb0a1a286cf3e3e7b7d22 /usr.bin/make | |
| parent | b49b9c3eae335d596a164d839a5f252dd4900677 (diff) | |
make: inline Buf_Clear
No functional change.
Diffstat (limited to 'usr.bin/make')
| -rw-r--r-- | usr.bin/make/buf.c | 12 | ||||
| -rw-r--r-- | usr.bin/make/buf.h | 11 | ||||
| -rw-r--r-- | usr.bin/make/for.c | 6 | ||||
| -rw-r--r-- | usr.bin/make/var.c | 6 |
4 files changed, 17 insertions, 18 deletions
diff --git a/usr.bin/make/buf.c b/usr.bin/make/buf.c index b07f25d73b4..73b2eac17d4 100644 --- a/usr.bin/make/buf.c +++ b/usr.bin/make/buf.c @@ -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 @@ Buf_AddFlag(Buffer *buf, bool flag, const char *name) } } -/* 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 --git a/usr.bin/make/buf.h b/usr.bin/make/buf.h index c04b4425fa5..14d048bfa51 100644 --- a/usr.bin/make/buf.h +++ b/usr.bin/make/buf.h @@ -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 @@ typedef struct Buffer { 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_AddBytesBetween(Buffer *, const char *, const char *); 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 --git a/usr.bin/make/for.c b/usr.bin/make/for.c index 49baf076fa5..2e714930617 100644 --- a/usr.bin/make/for.c +++ b/usr.bin/make/for.c @@ -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 @@ ForLoop_SubstBody(ForLoop *f, Buffer *body) 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 --git a/usr.bin/make/var.c b/usr.bin/make/var.c index 4fc1dff1d42..bcb57b9f42c 100644 --- a/usr.bin/make/var.c +++ b/usr.bin/make/var.c @@ -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 @@ Var_SetWithFlags(GNode *scope, const char *name, const char *val, 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); |
