Module Name:    src
Committed By:   rillig
Date:           Sun Oct 18 12:47:43 UTC 2020

Modified Files:
        src/usr.bin/make: dir.c hash.c hash.h main.c var.c

Log Message:
make(1): rename HashEntry.name to key


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 src/usr.bin/make/dir.c
cvs rdiff -u -r1.46 -r1.47 src/usr.bin/make/hash.c
cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/hash.h
cvs rdiff -u -r1.376 -r1.377 src/usr.bin/make/main.c
cvs rdiff -u -r1.576 -r1.577 src/usr.bin/make/var.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/dir.c
diff -u src/usr.bin/make/dir.c:1.165 src/usr.bin/make/dir.c:1.166
--- src/usr.bin/make/dir.c:1.165	Sun Oct 18 12:36:43 2020
+++ src/usr.bin/make/dir.c	Sun Oct 18 12:47:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: dir.c,v 1.165 2020/10/18 12:36:43 rillig Exp $	*/
+/*	$NetBSD: dir.c,v 1.166 2020/10/18 12:47:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -135,7 +135,7 @@
 #include "job.h"
 
 /*	"@(#)dir.c	8.2 (Berkeley) 1/2/94"	*/
-MAKE_RCSID("$NetBSD: dir.c,v 1.165 2020/10/18 12:36:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: dir.c,v 1.166 2020/10/18 12:47:43 rillig Exp $");
 
 #define DIR_DEBUG0(text) DEBUG0(DIR, text)
 #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1)
@@ -622,13 +622,12 @@ DirMatchFiles(const char *pattern, Cache
 	 * begins with a dot (note also that as a side effect of the hashing
 	 * scheme, .* won't match . or .. since they aren't hashed).
 	 */
-	if (Str_Match(entry->name, pattern) &&
-	    ((entry->name[0] != '.') ||
-	     (pattern[0] == '.')))
+	if (Str_Match(entry->key, pattern) &&
+	    (entry->key[0] != '.' || pattern[0] == '.'))
 	{
 	    Lst_Append(expansions,
-		       (isDot ? bmake_strdup(entry->name) :
-			str_concat3(dir->name, "/", entry->name)));
+		       (isDot ? bmake_strdup(entry->key) :
+			str_concat3(dir->name, "/", entry->key)));
 	}
     }
 }

Index: src/usr.bin/make/hash.c
diff -u src/usr.bin/make/hash.c:1.46 src/usr.bin/make/hash.c:1.47
--- src/usr.bin/make/hash.c:1.46	Sun Oct 18 12:36:43 2020
+++ src/usr.bin/make/hash.c	Sun Oct 18 12:47:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.c,v 1.46 2020/10/18 12:36:43 rillig Exp $	*/
+/*	$NetBSD: hash.c,v 1.47 2020/10/18 12:47:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -79,7 +79,7 @@
 #include "make.h"
 
 /*	"@(#)hash.c	8.1 (Berkeley) 6/6/93"	*/
-MAKE_RCSID("$NetBSD: hash.c,v 1.46 2020/10/18 12:36:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: hash.c,v 1.47 2020/10/18 12:47:43 rillig Exp $");
 
 /*
  * The ratio of # entries to # buckets at which we rebuild the table to
@@ -112,7 +112,7 @@ HashTable_Find(HashTable *t, unsigned in
 
 	for (e = t->buckets[h & t->bucketsMask]; e != NULL; e = e->next) {
 		chainlen++;
-		if (e->namehash == h && strcmp(e->name, key) == 0)
+		if (e->key_hash == h && strcmp(e->key, key) == 0)
 			break;
 	}
 
@@ -207,7 +207,7 @@ RebuildTable(HashTable *t)
 	for (hp = oldhp, i = (int)oldsize; --i >= 0;) {
 		for (e = *hp++; e != NULL; e = next) {
 			next = e->next;
-			xp = &t->buckets[e->namehash & mask];
+			xp = &t->buckets[e->key_hash & mask];
 			e->next = *xp;
 			*xp = e;
 		}
@@ -256,8 +256,8 @@ Hash_CreateEntry(HashTable *t, const cha
 	e->next = *hp;
 	*hp = e;
 	Hash_SetValue(e, NULL);
-	e->namehash = h;
-	memcpy(e->name, key, keylen + 1);
+	e->key_hash = h;
+	memcpy(e->key, key, keylen + 1);
 	t->numEntries++;
 
 	if (newPtr != NULL)
@@ -271,7 +271,7 @@ Hash_DeleteEntry(HashTable *t, HashEntry
 {
 	HashEntry **hp, *p;
 
-	for (hp = &t->buckets[e->namehash & t->bucketsMask];
+	for (hp = &t->buckets[e->key_hash & t->bucketsMask];
 	     (p = *hp) != NULL; hp = &p->next) {
 		if (p == e) {
 			*hp = p->next;

Index: src/usr.bin/make/hash.h
diff -u src/usr.bin/make/hash.h:1.28 src/usr.bin/make/hash.h:1.29
--- src/usr.bin/make/hash.h:1.28	Sun Oct 18 12:36:43 2020
+++ src/usr.bin/make/hash.h	Sun Oct 18 12:47:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: hash.h,v 1.28 2020/10/18 12:36:43 rillig Exp $	*/
+/*	$NetBSD: hash.h,v 1.29 2020/10/18 12:47:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -82,8 +82,8 @@ typedef struct HashEntry {
     struct HashEntry *next;	/* Used to link together all the entries
 				 * associated with the same bucket. */
     void	      *value;
-    unsigned	      namehash;	/* hash value of key */
-    char	      name[1];	/* key string, variable length */
+    unsigned	      key_hash;	/* hash value of the key */
+    char	      key[1];	/* key string, variable length */
 } HashEntry;
 
 /* The hash table containing the entries. */

Index: src/usr.bin/make/main.c
diff -u src/usr.bin/make/main.c:1.376 src/usr.bin/make/main.c:1.377
--- src/usr.bin/make/main.c:1.376	Sun Oct 18 12:36:43 2020
+++ src/usr.bin/make/main.c	Sun Oct 18 12:47:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.376 2020/10/18 12:36:43 rillig Exp $	*/
+/*	$NetBSD: main.c,v 1.377 2020/10/18 12:47:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -118,7 +118,7 @@
 #include "trace.h"
 
 /*	"@(#)main.c	8.3 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: main.c,v 1.376 2020/10/18 12:36:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: main.c,v 1.377 2020/10/18 12:47:43 rillig Exp $");
 #if defined(MAKE_NATIVE) && !defined(lint)
 __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 "
 	    "The Regents of the University of California.  "
@@ -1964,9 +1964,9 @@ purge_cached_realpaths(void)
     he = HashIter_Next(&hi);
     while (he != NULL) {
 	nhe = HashIter_Next(&hi);
-	if (he->name[0] != '/') {
+	if (he->key[0] != '/') {
 	    if (DEBUG(DIR))
-		fprintf(stderr, "cached_realpath: purging %s\n", he->name);
+		fprintf(stderr, "cached_realpath: purging %s\n", he->key);
 	    Hash_DeleteEntry(&cache->context, he);
 	}
 	he = nhe;

Index: src/usr.bin/make/var.c
diff -u src/usr.bin/make/var.c:1.576 src/usr.bin/make/var.c:1.577
--- src/usr.bin/make/var.c:1.576	Sun Oct 18 12:36:43 2020
+++ src/usr.bin/make/var.c	Sun Oct 18 12:47:43 2020
@@ -1,4 +1,4 @@
-/*	$NetBSD: var.c,v 1.576 2020/10/18 12:36:43 rillig Exp $	*/
+/*	$NetBSD: var.c,v 1.577 2020/10/18 12:47:43 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -121,7 +121,7 @@
 #include    "metachar.h"
 
 /*	"@(#)var.c	8.3 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: var.c,v 1.576 2020/10/18 12:36:43 rillig Exp $");
+MAKE_RCSID("$NetBSD: var.c,v 1.577 2020/10/18 12:47:43 rillig Exp $");
 
 #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1)
 #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2)
@@ -429,8 +429,8 @@ static void
 VarAdd(const char *name, const char *val, GNode *ctxt, VarSet_Flags flags)
 {
     HashEntry *he = Hash_CreateEntry(&ctxt->context, name, NULL);
-    Var *v = VarNew(he->name, NULL, val,
-		      flags & VAR_SET_READONLY ? VAR_READONLY : 0);
+    Var *v = VarNew(he->key, NULL, val,
+		    flags & VAR_SET_READONLY ? VAR_READONLY : 0);
     Hash_SetValue(he, v);
     if (!(ctxt->flags & INTERNAL)) {
 	VAR_DEBUG3("%s:%s = %s\n", ctxt->name, name, val);
@@ -3865,7 +3865,7 @@ Var_Dump(GNode *ctxt)
 
     HashIter_Init(&hi, &ctxt->context);
     while ((he = HashIter_Next(&hi)) != NULL)
-	Vector_Push(&varnames, he->name);
+	Vector_Push(&varnames, he->key);
 
     qsort(varnames.items, varnames.len, sizeof varnames.items[0], str_cmp_asc);
 

Reply via email to