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): rename HashEntry.name to key



details:   https://anonhg.NetBSD.org/src/rev/9e90eee9bf34
branches:  trunk
changeset: 944990:9e90eee9bf34
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Oct 18 12:47:43 2020 +0000

description:
make(1): rename HashEntry.name to key

diffstat:

 usr.bin/make/dir.c  |  13 ++++++-------
 usr.bin/make/hash.c |  14 +++++++-------
 usr.bin/make/hash.h |   6 +++---
 usr.bin/make/main.c |   8 ++++----
 usr.bin/make/var.c  |  10 +++++-----
 5 files changed, 25 insertions(+), 26 deletions(-)

diffs (180 lines):

diff -r ff72cac648ba -r 9e90eee9bf34 usr.bin/make/dir.c
--- a/usr.bin/make/dir.c        Sun Oct 18 12:47:37 2020 +0000
+++ b/usr.bin/make/dir.c        Sun Oct 18 12:47:43 2020 +0000
@@ -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 @@
         * 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)));
        }
     }
 }
diff -r ff72cac648ba -r 9e90eee9bf34 usr.bin/make/hash.c
--- a/usr.bin/make/hash.c       Sun Oct 18 12:47:37 2020 +0000
+++ b/usr.bin/make/hash.c       Sun Oct 18 12:47:43 2020 +0000
@@ -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 @@
 
        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 @@
        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 @@
        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 @@
 {
        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;
diff -r ff72cac648ba -r 9e90eee9bf34 usr.bin/make/hash.h
--- a/usr.bin/make/hash.h       Sun Oct 18 12:47:37 2020 +0000
+++ b/usr.bin/make/hash.h       Sun Oct 18 12:47:43 2020 +0000
@@ -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 @@
     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. */
diff -r ff72cac648ba -r 9e90eee9bf34 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Sun Oct 18 12:47:37 2020 +0000
+++ b/usr.bin/make/main.c       Sun Oct 18 12:47:43 2020 +0000
@@ -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 @@
     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;
diff -r ff72cac648ba -r 9e90eee9bf34 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Oct 18 12:47:37 2020 +0000
+++ b/usr.bin/make/var.c        Sun Oct 18 12:47:43 2020 +0000
@@ -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 @@
 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 @@
 
     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);
 



Home | Main Index | Thread Index | Old Index