Module Name: src
Committed By: rillig
Date: Fri Aug 21 04:57:56 UTC 2020
Modified Files:
src/usr.bin/make: lst.c
Log Message:
make(1): remove unnecessary macro PAlloc
The ptype parameter was never used, which made it redundant. The
remaining text is so simple that it's not worth having a macro for this
purpose. This makes it easier to read the code since the previously
implicit variable assignment is now clearly visible.
To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/lst.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/make/lst.c
diff -u src/usr.bin/make/lst.c:1.10 src/usr.bin/make/lst.c:1.11
--- src/usr.bin/make/lst.c:1.10 Fri Aug 21 04:42:02 2020
+++ src/usr.bin/make/lst.c Fri Aug 21 04:57:56 2020
@@ -1,4 +1,4 @@
-/* $NetBSD: lst.c,v 1.10 2020/08/21 04:42:02 rillig Exp $ */
+/* $NetBSD: lst.c,v 1.11 2020/08/21 04:57:56 rillig Exp $ */
/*
* Copyright (c) 1988, 1989, 1990, 1993
@@ -38,11 +38,11 @@
#include "make_malloc.h"
#ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: lst.c,v 1.10 2020/08/21 04:42:02 rillig Exp $";
+static char rcsid[] = "$NetBSD: lst.c,v 1.11 2020/08/21 04:57:56 rillig Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
-__RCSID("$NetBSD: lst.c,v 1.10 2020/08/21 04:42:02 rillig Exp $");
+__RCSID("$NetBSD: lst.c,v 1.11 2020/08/21 04:57:56 rillig Exp $");
#endif /* not lint */
#endif
@@ -75,13 +75,6 @@ typedef struct List {
} *List;
/*
- * PAlloc (var, ptype) --
- * Allocate a pointer-typedef structure 'ptype' into the variable 'var'
- */
-#define PAlloc(var, ptype) \
- var = (ptype) bmake_malloc(sizeof *(var))
-
-/*
* LstValid --
* Return TRUE if the list is valid
*/
@@ -117,7 +110,7 @@ Lst_Init(void)
{
List nList;
- PAlloc (nList, List);
+ nList = bmake_malloc(sizeof *nList);
nList->firstPtr = NULL;
nList->lastPtr = NULL;
@@ -267,7 +260,7 @@ Lst_InsertBefore(Lst l, LstNode ln, void
}
ok:
- PAlloc (nLNode, ListNode);
+ nLNode = bmake_malloc(sizeof *nLNode);
nLNode->datum = d;
nLNode->useCount = 0;
@@ -333,7 +326,7 @@ Lst_InsertAfter(Lst l, LstNode ln, void
list = l;
lNode = ln;
- PAlloc (nLNode, ListNode);
+ nLNode = bmake_malloc(sizeof *nLNode);
nLNode->datum = d;
nLNode->useCount = 0;
nLNode->deleted = FALSE;
@@ -843,7 +836,7 @@ Lst_Concat(Lst l1, Lst l2, int flags)
ln != NULL;
ln = ln->nextPtr)
{
- PAlloc (nln, ListNode);
+ nln = bmake_malloc(sizeof *nln);
nln->datum = ln->datum;
if (last != NULL) {
last->nextPtr = nln;