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): remove trailing Z from buffer functions
details: https://anonhg.NetBSD.org/src/rev/37156bfd5e86
branches: trunk
changeset: 937083:37156bfd5e86
user: rillig <rillig%NetBSD.org@localhost>
date: Sat Aug 08 18:54:04 2020 +0000
description:
make(1): remove trailing Z from buffer functions
This Z had been useful during the migration from int to size_t. This
migration is finished, at least for the Buffer type, so the Z is no
longer necessary.
diffstat:
usr.bin/make/buf.c | 18 ++++++++--------
usr.bin/make/buf.h | 8 +++---
usr.bin/make/cond.c | 14 ++++++------
usr.bin/make/for.c | 14 ++++++------
usr.bin/make/main.c | 10 ++++----
usr.bin/make/var.c | 58 ++++++++++++++++++++++++++--------------------------
6 files changed, 61 insertions(+), 61 deletions(-)
diffs (truncated from 513 to 300 lines):
diff -r 948a3efb46af -r 37156bfd5e86 usr.bin/make/buf.c
--- a/usr.bin/make/buf.c Sat Aug 08 18:50:11 2020 +0000
+++ b/usr.bin/make/buf.c Sat Aug 08 18:54:04 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: buf.c,v 1.31 2020/08/03 20:26:09 rillig Exp $ */
+/* $NetBSD: buf.c,v 1.32 2020/08/08 18:54:04 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: buf.c,v 1.31 2020/08/03 20:26:09 rillig Exp $";
+static char rcsid[] = "$NetBSD: buf.c,v 1.32 2020/08/08 18:54:04 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)buf.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: buf.c,v 1.31 2020/08/03 20:26:09 rillig Exp $");
+__RCSID("$NetBSD: buf.c,v 1.32 2020/08/08 18:54:04 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -104,7 +104,7 @@
/* Add the given bytes to the buffer. */
void
-Buf_AddBytesZ(Buffer *bp, const Byte *bytesPtr, size_t numBytes)
+Buf_AddBytes(Buffer *bp, const Byte *bytesPtr, size_t numBytes)
{
size_t count = bp->count;
Byte *ptr;
@@ -124,14 +124,14 @@
void
Buf_AddBytesBetween(Buffer *bp, const char *start, const char *end)
{
- Buf_AddBytesZ(bp, start, (size_t)(end - start));
+ Buf_AddBytes(bp, start, (size_t)(end - start));
}
/* Add the given string to the buffer. */
void
Buf_AddStr(Buffer *bp, const char *str)
{
- Buf_AddBytesZ(bp, str, strlen(str));
+ Buf_AddBytes(bp, str, strlen(str));
}
/* Add the given number to the buffer. */
@@ -147,7 +147,7 @@
char buf[1 + (bits + 2) / 3 + 1];
size_t len = (size_t)snprintf(buf, sizeof buf, "%d", n);
- Buf_AddBytesZ(bp, buf, len);
+ Buf_AddBytes(bp, buf, len);
}
/* Get the data (usually a string) from the buffer.
@@ -157,7 +157,7 @@
* Returns the pointer to the data and optionally the length of the
* data in the buffer. */
Byte *
-Buf_GetAllZ(Buffer *bp, size_t *numBytesPtr)
+Buf_GetAll(Buffer *bp, size_t *numBytesPtr)
{
if (numBytesPtr != NULL)
*numBytesPtr = bp->count;
@@ -175,7 +175,7 @@
/* Initialize a buffer.
* If the given initial size is 0, a reasonable default is used. */
void
-Buf_InitZ(Buffer *bp, size_t size)
+Buf_Init(Buffer *bp, size_t size)
{
if (size <= 0) {
size = BUF_DEF_SIZE;
diff -r 948a3efb46af -r 37156bfd5e86 usr.bin/make/buf.h
--- a/usr.bin/make/buf.h Sat Aug 08 18:50:11 2020 +0000
+++ b/usr.bin/make/buf.h Sat Aug 08 18:54:04 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: buf.h,v 1.22 2020/08/01 21:40:49 rillig Exp $ */
+/* $NetBSD: buf.h,v 1.23 2020/08/08 18:54:04 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -111,13 +111,13 @@
#define Buf_Size(bp) ((bp)->count)
void Buf_Expand_1(Buffer *);
-void Buf_AddBytesZ(Buffer *, const Byte *, size_t);
+void Buf_AddBytes(Buffer *, const Byte *, size_t);
void Buf_AddBytesBetween(Buffer *, const Byte *, const Byte *);
void Buf_AddStr(Buffer *, const char *);
void Buf_AddInt(Buffer *, int);
-Byte *Buf_GetAllZ(Buffer *, size_t *);
+Byte *Buf_GetAll(Buffer *, size_t *);
void Buf_Empty(Buffer *);
-void Buf_InitZ(Buffer *, size_t);
+void Buf_Init(Buffer *, size_t);
Byte *Buf_Destroy(Buffer *, Boolean);
Byte *Buf_DestroyCompact(Buffer *);
diff -r 948a3efb46af -r 37156bfd5e86 usr.bin/make/cond.c
--- a/usr.bin/make/cond.c Sat Aug 08 18:50:11 2020 +0000
+++ b/usr.bin/make/cond.c Sat Aug 08 18:54:04 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: cond.c,v 1.91 2020/08/08 17:03:04 rillig Exp $ */
+/* $NetBSD: cond.c,v 1.92 2020/08/08 18:54:04 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: cond.c,v 1.91 2020/08/08 17:03:04 rillig Exp $";
+static char rcsid[] = "$NetBSD: cond.c,v 1.92 2020/08/08 18:54:04 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)cond.c 8.2 (Berkeley) 1/2/94";
#else
-__RCSID("$NetBSD: cond.c,v 1.91 2020/08/08 17:03:04 rillig Exp $");
+__RCSID("$NetBSD: cond.c,v 1.92 2020/08/08 18:54:04 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -221,7 +221,7 @@
* Create a buffer for the argument and start it out at 16 characters
* long. Why 16? Why not?
*/
- Buf_InitZ(&buf, 16);
+ Buf_Init(&buf, 16);
paren_depth = 0;
for (;;) {
@@ -255,7 +255,7 @@
cp++;
}
- *argPtr = Buf_GetAllZ(&buf, &argLen);
+ *argPtr = Buf_GetAll(&buf, &argLen);
Buf_Destroy(&buf, FALSE);
while (*cp == ' ' || *cp == '\t') {
@@ -399,7 +399,7 @@
int qt;
const char *start;
- Buf_InitZ(&buf, 0);
+ Buf_Init(&buf, 0);
str = NULL;
*freeIt = NULL;
*quoted = qt = *condExpr == '"' ? 1 : 0;
@@ -490,7 +490,7 @@
}
}
got_str:
- *freeIt = Buf_GetAllZ(&buf, NULL);
+ *freeIt = Buf_GetAll(&buf, NULL);
str = *freeIt;
cleanup:
Buf_Destroy(&buf, FALSE);
diff -r 948a3efb46af -r 37156bfd5e86 usr.bin/make/for.c
--- a/usr.bin/make/for.c Sat Aug 08 18:50:11 2020 +0000
+++ b/usr.bin/make/for.c Sat Aug 08 18:54:04 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: for.c,v 1.61 2020/08/03 20:26:09 rillig Exp $ */
+/* $NetBSD: for.c,v 1.62 2020/08/08 18:54:04 rillig Exp $ */
/*
* Copyright (c) 1992, The Regents of the University of California.
@@ -30,14 +30,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: for.c,v 1.61 2020/08/03 20:26:09 rillig Exp $";
+static char rcsid[] = "$NetBSD: for.c,v 1.62 2020/08/08 18:54:04 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)for.c 8.1 (Berkeley) 6/6/93";
#else
-__RCSID("$NetBSD: for.c,v 1.61 2020/08/03 20:26:09 rillig Exp $");
+__RCSID("$NetBSD: for.c,v 1.62 2020/08/08 18:54:04 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -270,7 +270,7 @@
}
}
- Buf_InitZ(&new_for->buf, 0);
+ Buf_Init(&new_for->buf, 0);
accumFor = new_for;
forLevel = 1;
return 1;
@@ -364,7 +364,7 @@
if (ch == '$') {
size_t len = for_var_len(item);
if (len != 0) {
- Buf_AddBytesZ(cmds, item - 1, len + 1);
+ Buf_AddBytes(cmds, item - 1, len + 1);
item += len;
continue;
}
@@ -409,9 +409,9 @@
* to contrive a makefile where an unwanted substitution happens.
*/
- cmd_cp = Buf_GetAllZ(&arg->buf, &cmd_len);
+ cmd_cp = Buf_GetAll(&arg->buf, &cmd_len);
body_end = cmd_cp + cmd_len;
- Buf_InitZ(&cmds, cmd_len + 256);
+ Buf_Init(&cmds, cmd_len + 256);
for (cp = cmd_cp; (cp = strchr(cp, '$')) != NULL;) {
char ech;
ch = *++cp;
diff -r 948a3efb46af -r 37156bfd5e86 usr.bin/make/main.c
--- a/usr.bin/make/main.c Sat Aug 08 18:50:11 2020 +0000
+++ b/usr.bin/make/main.c Sat Aug 08 18:54:04 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.296 2020/08/03 20:26:09 rillig Exp $ */
+/* $NetBSD: main.c,v 1.297 2020/08/08 18:54:04 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.296 2020/08/03 20:26:09 rillig Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.297 2020/08/08 18:54:04 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
@@ -81,7 +81,7 @@
#if 0
static char sccsid[] = "@(#)main.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: main.c,v 1.296 2020/08/03 20:26:09 rillig Exp $");
+__RCSID("$NetBSD: main.c,v 1.297 2020/08/08 18:54:04 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -1661,14 +1661,14 @@
(void)close(fds[1]);
savederr = 0;
- Buf_InitZ(&buf, 0);
+ Buf_Init(&buf, 0);
/* XXX: split variable cc into 2 */
do {
char result[BUFSIZ];
cc = read(fds[0], result, sizeof(result));
if (cc > 0)
- Buf_AddBytesZ(&buf, result, (size_t)cc);
+ Buf_AddBytes(&buf, result, (size_t)cc);
}
while (cc > 0 || (cc == -1 && errno == EINTR));
if (cc == -1)
diff -r 948a3efb46af -r 37156bfd5e86 usr.bin/make/var.c
--- a/usr.bin/make/var.c Sat Aug 08 18:50:11 2020 +0000
+++ b/usr.bin/make/var.c Sat Aug 08 18:54:04 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: var.c,v 1.432 2020/08/08 18:50:11 rillig Exp $ */
+/* $NetBSD: var.c,v 1.433 2020/08/08 18:54:04 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
*/
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.432 2020/08/08 18:50:11 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.433 2020/08/08 18:54:04 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: var.c,v 1.432 2020/08/08 18:50:11 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.433 2020/08/08 18:54:04 rillig Exp $");
#endif
#endif /* not lint */
#endif
@@ -381,8 +381,8 @@
v->name = bmake_strdup(name);
len = strlen(env);
- Buf_InitZ(&v->val, len + 1);
- Buf_AddBytesZ(&v->val, env, len);
+ Buf_Init(&v->val, len + 1);
Home |
Main Index |
Thread Index |
Old Index