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 unnecessary macro PAlloc



details:   https://anonhg.NetBSD.org/src/rev/3edf9a6cbfab
branches:  trunk
changeset: 942869:3edf9a6cbfab
user:      rillig <rillig%NetBSD.org@localhost>
date:      Fri Aug 21 04:57:56 2020 +0000

description:
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.

diffstat:

 usr.bin/make/lst.c |  21 +++++++--------------
 1 files changed, 7 insertions(+), 14 deletions(-)

diffs (73 lines):

diff -r 369bc602dce6 -r 3edf9a6cbfab usr.bin/make/lst.c
--- a/usr.bin/make/lst.c        Fri Aug 21 04:42:02 2020 +0000
+++ b/usr.bin/make/lst.c        Fri Aug 21 04:57:56 2020 +0000
@@ -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 @@
 } *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 @@
 {
     List nList;
 
-    PAlloc (nList, List);
+    nList = bmake_malloc(sizeof *nList);
 
     nList->firstPtr = NULL;
     nList->lastPtr = NULL;
@@ -267,7 +260,7 @@
     }
 
     ok:
-    PAlloc (nLNode, ListNode);
+    nLNode = bmake_malloc(sizeof *nLNode);
 
     nLNode->datum = d;
     nLNode->useCount = 0;
@@ -333,7 +326,7 @@
     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 @@
             ln != NULL;
             ln = ln->nextPtr)
        {
-           PAlloc (nln, ListNode);
+           nln = bmake_malloc(sizeof *nln);
            nln->datum = ln->datum;
            if (last != NULL) {
                last->nextPtr = nln;



Home | Main Index | Thread Index | Old Index