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(1): inline Buf_Len
details: https://anonhg.NetBSD.org/src/rev/a1b3580b9fe8
branches: trunk
changeset: 959062:a1b3580b9fe8
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Jan 30 21:25:10 2021 +0000
description:
make(1): inline Buf_Len
diffstat:
usr.bin/make/buf.h | 12 +++---------
usr.bin/make/main.c | 8 ++++----
usr.bin/make/var.c | 10 +++++-----
3 files changed, 12 insertions(+), 18 deletions(-)
diffs (114 lines):
diff -r f21fe4e473f7 -r a1b3580b9fe8 usr.bin/make/buf.h
--- a/usr.bin/make/buf.h Sat Jan 30 21:24:46 2021 +0000
+++ b/usr.bin/make/buf.h Sat Jan 30 21:25:10 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: buf.h,v 1.41 2021/01/30 21:18:14 rillig Exp $ */
+/* $NetBSD: buf.h,v 1.42 2021/01/30 21:25:10 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -81,8 +81,8 @@
/* An automatically growing null-terminated buffer of characters. */
typedef struct Buffer {
- size_t cap; /* Allocated size of the buffer, including the null */
- size_t len; /* Number of bytes in buffer, excluding the null */
+ size_t cap; /* Allocated size of the buffer, including the '\0' */
+ size_t len; /* Number of bytes in buffer, excluding the '\0' */
char *data; /* The buffer itself (always null-terminated) */
} Buffer;
@@ -101,12 +101,6 @@
end[1] = '\0';
}
-MAKE_INLINE size_t
-Buf_Len(const Buffer *buf)
-{
- return buf->len;
-}
-
MAKE_INLINE Boolean
Buf_EndsWith(const Buffer *buf, char ch)
{
diff -r f21fe4e473f7 -r a1b3580b9fe8 usr.bin/make/main.c
--- a/usr.bin/make/main.c Sat Jan 30 21:24:46 2021 +0000
+++ b/usr.bin/make/main.c Sat Jan 30 21:25:10 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.519 2021/01/30 21:03:32 rillig Exp $ */
+/* $NetBSD: main.c,v 1.520 2021/01/30 21:25:10 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -110,7 +110,7 @@
#include "trace.h"
/* "@(#)main.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: main.c,v 1.519 2021/01/30 21:03:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.520 2021/01/30 21:25:10 rillig Exp $");
#if defined(MAKE_NATIVE) && !defined(lint)
__COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
"The Regents of the University of California. "
@@ -1840,7 +1840,7 @@
while ((pid = waitpid(cpid, &status, 0)) != cpid && pid >= 0)
JobReapChild(pid, status, FALSE);
- res_len = Buf_Len(&buf);
+ res_len = buf.len;
res = Buf_DoneData(&buf);
if (savederr != 0)
@@ -2025,7 +2025,7 @@
Buf_AddStr(&buf, strerror(errno));
Buf_AddStr(&buf, ")\n");
- write_all(STDERR_FILENO, buf.data, Buf_Len(&buf));
+ write_all(STDERR_FILENO, buf.data, buf.len);
Buf_Done(&buf);
_exit(1);
diff -r f21fe4e473f7 -r a1b3580b9fe8 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sat Jan 30 21:24:46 2021 +0000
+++ b/usr.bin/make/var.c Sat Jan 30 21:25:10 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.785 2021/01/30 21:03:32 rillig Exp $ */
+/* $NetBSD: var.c,v 1.786 2021/01/30 21:25:10 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -131,7 +131,7 @@
#include "metachar.h"
/* "@(#)var.c 8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.785 2021/01/30 21:03:32 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.786 2021/01/30 21:25:10 rillig Exp $");
typedef enum VarFlags {
VAR_NONE = 0,
@@ -1745,7 +1745,7 @@
for (i = 0; i < words.len; i++) {
modifyWord(words.words[i], &result, modifyWord_args);
- if (Buf_Len(&result.buf) > 0)
+ if (result.buf.len > 0)
SepBuf_Sep(&result);
}
@@ -2164,7 +2164,7 @@
*pp = ++p;
if (out_length != NULL)
- *out_length = Buf_Len(&buf);
+ *out_length = buf.len;
*out_part = Buf_DoneData(&buf);
DEBUG1(VAR, "Modifier part: \"%s\"\n", *out_part);
@@ -3804,7 +3804,7 @@
}
}
*pp = p;
- *out_varname_len = Buf_Len(&buf);
+ *out_varname_len = buf.len;
return Buf_DoneData(&buf);
}
Home |
Main Index |
Thread Index |
Old Index