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): replace Hash_FindEntry with Hash_FindV...



details:   https://anonhg.NetBSD.org/src/rev/c291bbe4edf4
branches:  trunk
changeset: 939380:c291bbe4edf4
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Sep 26 14:59:21 2020 +0000

description:
make(1): replace Hash_FindEntry with Hash_FindValue in Targ_FindNode

diffstat:

 usr.bin/make/targ.c |  21 ++++++++-------------
 1 files changed, 8 insertions(+), 13 deletions(-)

diffs (47 lines):

diff -r 8b41ea548522 -r c291bbe4edf4 usr.bin/make/targ.c
--- a/usr.bin/make/targ.c       Sat Sep 26 14:48:31 2020 +0000
+++ b/usr.bin/make/targ.c       Sat Sep 26 14:59:21 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: targ.c,v 1.93 2020/09/24 07:59:33 rillig Exp $ */
+/*     $NetBSD: targ.c,v 1.94 2020/09/26 14:59:21 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -122,7 +122,7 @@
 #include         "dir.h"
 
 /*     "@(#)targ.c     8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: targ.c,v 1.93 2020/09/24 07:59:33 rillig Exp $");
+MAKE_RCSID("$NetBSD: targ.c,v 1.94 2020/09/26 14:59:21 rillig Exp $");
 
 static GNodeList *allTargets;  /* the list of all targets found so far */
 #ifdef CLEANUP
@@ -255,22 +255,17 @@
 GNode *
 Targ_FindNode(const char *name, int flags)
 {
-    GNode         *gn;       /* node in that element */
-    Hash_Entry   *he = NULL; /* New or used hash entry for node */
-    Boolean      isNew;      /* Set TRUE if Hash_CreateEntry had to create */
-                             /* an entry for the node */
+    GNode *gn;                 /* node in that element */
+    Hash_Entry *he;            /* New or used hash entry for node */
 
-    if (!(flags & (TARG_CREATE | TARG_NOHASH))) {
-       he = Hash_FindEntry(&targets, name);
-       if (he == NULL)
-           return NULL;
-       return (GNode *)Hash_GetValue(he);
-    }
+    if (!(flags & TARG_CREATE) && !(flags & TARG_NOHASH))
+       return Hash_FindValue(&targets, name);
 
     if (!(flags & TARG_NOHASH)) {
+       Boolean isNew;
        he = Hash_CreateEntry(&targets, name, &isNew);
        if (!isNew)
-           return (GNode *)Hash_GetValue(he);
+           return Hash_GetValue(he);
     }
 
     gn = Targ_NewGN(name);



Home | Main Index | Thread Index | Old Index