Module Name:    src
Committed By:   rillig
Date:           Sat Sep 26 14:59:21 UTC 2020

Modified Files:
        src/usr.bin/make: targ.c

Log Message:
make(1): replace Hash_FindEntry with Hash_FindValue in Targ_FindNode


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/usr.bin/make/targ.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/targ.c
diff -u src/usr.bin/make/targ.c:1.93 src/usr.bin/make/targ.c:1.94
--- src/usr.bin/make/targ.c:1.93	Thu Sep 24 07:59:33 2020
+++ src/usr.bin/make/targ.c	Sat Sep 26 14:59:21 2020
@@ -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 @@ TargFreeGN(void *gnp)
 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 */
-
-    if (!(flags & (TARG_CREATE | TARG_NOHASH))) {
-	he = Hash_FindEntry(&targets, name);
-	if (he == NULL)
-	    return NULL;
-	return (GNode *)Hash_GetValue(he);
-    }
+    GNode *gn;			/* node in that element */
+    Hash_Entry *he;		/* New or used hash entry for node */
+
+    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);

Reply via email to