Module Name: src Committed By: rillig Date: Sun Oct 18 12:36:43 UTC 2020
Modified Files: src/usr.bin/make: arch.c dir.c dir.h hash.c hash.h main.c make.h targ.c var.c Log Message: make(1): remove underscore from Hash_Table and Hash_Entry For consistency with the other type names, such as GNodeListNode. To generate a diff of this commit: cvs rdiff -u -r1.134 -r1.135 src/usr.bin/make/arch.c cvs rdiff -u -r1.164 -r1.165 src/usr.bin/make/dir.c cvs rdiff -u -r1.29 -r1.30 src/usr.bin/make/dir.h cvs rdiff -u -r1.45 -r1.46 src/usr.bin/make/hash.c cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/hash.h cvs rdiff -u -r1.375 -r1.376 src/usr.bin/make/main.c cvs rdiff -u -r1.157 -r1.158 src/usr.bin/make/make.h cvs rdiff -u -r1.114 -r1.115 src/usr.bin/make/targ.c cvs rdiff -u -r1.575 -r1.576 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/arch.c diff -u src/usr.bin/make/arch.c:1.134 src/usr.bin/make/arch.c:1.135 --- src/usr.bin/make/arch.c:1.134 Sun Oct 18 12:00:16 2020 +++ src/usr.bin/make/arch.c Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arch.c,v 1.134 2020/10/18 12:00:16 rillig Exp $ */ +/* $NetBSD: arch.c,v 1.135 2020/10/18 12:36:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -130,7 +130,7 @@ #include "config.h" /* "@(#)arch.c 8.2 (Berkeley) 1/2/94" */ -MAKE_RCSID("$NetBSD: arch.c,v 1.134 2020/10/18 12:00:16 rillig Exp $"); +MAKE_RCSID("$NetBSD: arch.c,v 1.135 2020/10/18 12:36:43 rillig Exp $"); #ifdef TARGET_MACHINE #undef MAKE_MACHINE @@ -148,7 +148,7 @@ static ArchList *archives; /* The archiv typedef struct Arch { char *name; /* Name of archive */ - Hash_Table members; /* All the members of the archive described + HashTable members; /* All the members of the archive described * by <name, struct ar_hdr *> key/value pairs */ char *fnametab; /* Extended name table strings */ size_t fnamesize; /* Size of the string table */ @@ -167,7 +167,7 @@ ArchFree(void *ap) { Arch *a = (Arch *)ap; HashIter hi; - Hash_Entry *he; + HashEntry *he; /* Free memory from hash entries */ HashIter_Init(&hi, &a->members); @@ -606,7 +606,7 @@ ArchStatMember(const char *archive, cons #endif { - Hash_Entry *he; + HashEntry *he; he = Hash_CreateEntry(&ar->members, memName, NULL); Hash_SetValue(he, bmake_malloc(sizeof(struct ar_hdr))); memcpy(Hash_GetValue(he), &arh, sizeof(struct ar_hdr)); Index: src/usr.bin/make/dir.c diff -u src/usr.bin/make/dir.c:1.164 src/usr.bin/make/dir.c:1.165 --- src/usr.bin/make/dir.c:1.164 Sun Oct 18 10:44:25 2020 +++ src/usr.bin/make/dir.c Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.c,v 1.164 2020/10/18 10:44:25 rillig Exp $ */ +/* $NetBSD: dir.c,v 1.165 2020/10/18 12:36: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.164 2020/10/18 10:44:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: dir.c,v 1.165 2020/10/18 12:36:43 rillig Exp $"); #define DIR_DEBUG0(text) DEBUG0(DIR, text) #define DIR_DEBUG1(fmt, arg1) DEBUG1(DIR, fmt, arg1) @@ -221,7 +221,7 @@ SearchPath *dirSearchPath; /* main sear /* A list of cached directories, with fast lookup by directory name. */ typedef struct OpenDirs { CachedDirList *list; - Hash_Table /* of CachedDirListNode */ table; + HashTable /* of CachedDirListNode */ table; } OpenDirs; static void @@ -255,7 +255,7 @@ OpenDirs_Find(OpenDirs *odirs, const cha static void OpenDirs_Add(OpenDirs *odirs, CachedDir *cdir) { - Hash_Entry *he = Hash_FindEntry(&odirs->table, cdir->name); + HashEntry *he = Hash_FindEntry(&odirs->table, cdir->name); if (he != NULL) return; he = Hash_CreateEntry(&odirs->table, cdir->name, NULL); @@ -266,7 +266,7 @@ OpenDirs_Add(OpenDirs *odirs, CachedDir static void OpenDirs_Remove(OpenDirs *odirs, const char *name) { - Hash_Entry *he = Hash_FindEntry(&odirs->table, name); + HashEntry *he = Hash_FindEntry(&odirs->table, name); CachedDirListNode *ln; if (he == NULL) return; @@ -298,9 +298,9 @@ static CachedDir *dotLast; /* a fake pat * already updated the file, in which case we'll update it again. Generally, * there won't be two rules to update a single file, so this should be ok, * but... */ -static Hash_Table mtimes; +static HashTable mtimes; -static Hash_Table lmtimes; /* same as mtimes but for lstat */ +static HashTable lmtimes; /* same as mtimes but for lstat */ /* * We use stat(2) a lot, cache the results. @@ -320,10 +320,10 @@ typedef enum { /* Returns 0 and the result of stat(2) or lstat(2) in *mst, or -1 on error. */ static int -cached_stats(Hash_Table *htp, const char *pathname, struct make_stat *mst, +cached_stats(HashTable *htp, const char *pathname, struct make_stat *mst, CachedStatsFlags flags) { - Hash_Entry *entry; + HashEntry *entry; struct stat sys_st; struct cache_st *cst; int rc; @@ -609,7 +609,7 @@ static void DirMatchFiles(const char *pattern, CachedDir *dir, StringList *expansions) { HashIter hi; - Hash_Entry *entry; /* Current entry in the table */ + HashEntry *entry; /* Current entry in the table */ Boolean isDot; /* TRUE if the directory being searched is . */ isDot = (dir->name[0] == '.' && dir->name[1] == '\0'); Index: src/usr.bin/make/dir.h diff -u src/usr.bin/make/dir.h:1.29 src/usr.bin/make/dir.h:1.30 --- src/usr.bin/make/dir.h:1.29 Mon Oct 5 22:45:47 2020 +++ src/usr.bin/make/dir.h Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: dir.h,v 1.29 2020/10/05 22:45:47 rillig Exp $ */ +/* $NetBSD: dir.h,v 1.30 2020/10/18 12:36:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -87,7 +87,7 @@ typedef struct CachedDir { int refCount; /* Number of SearchPaths with this directory */ int hits; /* The number of times a file in this * directory has been found */ - Hash_Table files; /* Hash set of files in directory */ + HashTable files; /* Hash set of files in directory */ } CachedDir; void Dir_Init(void); Index: src/usr.bin/make/hash.c diff -u src/usr.bin/make/hash.c:1.45 src/usr.bin/make/hash.c:1.46 --- src/usr.bin/make/hash.c:1.45 Sun Oct 18 10:44:25 2020 +++ src/usr.bin/make/hash.c Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.c,v 1.45 2020/10/18 10:44:25 rillig Exp $ */ +/* $NetBSD: hash.c,v 1.46 2020/10/18 12:36: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.45 2020/10/18 10:44:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: hash.c,v 1.46 2020/10/18 12:36:43 rillig Exp $"); /* * The ratio of # entries to # buckets at which we rebuild the table to @@ -100,10 +100,10 @@ hash(const char *key, size_t *out_keylen return h; } -static Hash_Entry * -HashTable_Find(Hash_Table *t, unsigned int h, const char *key) +static HashEntry * +HashTable_Find(HashTable *t, unsigned int h, const char *key) { - Hash_Entry *e; + HashEntry *e; unsigned int chainlen = 0; #ifdef DEBUG_HASH_LOOKUP @@ -124,10 +124,10 @@ HashTable_Find(Hash_Table *t, unsigned i /* Sets up the hash table. */ void -Hash_InitTable(Hash_Table *t) +Hash_InitTable(HashTable *t) { unsigned int n = 16, i; - struct Hash_Entry **hp; + HashEntry **hp; t->numEntries = 0; t->maxchain = 0; @@ -139,11 +139,11 @@ Hash_InitTable(Hash_Table *t) } /* Removes everything from the hash table and frees up the memory space it - * occupied (except for the space in the Hash_Table structure). */ + * occupied (except for the space in the HashTable structure). */ void -Hash_DeleteTable(Hash_Table *t) +Hash_DeleteTable(HashTable *t) { - struct Hash_Entry **hp, *h, *nexth = NULL; + HashEntry **hp, *h, *nexth = NULL; int i; for (hp = t->buckets, i = (int)t->bucketsSize; --i >= 0;) { @@ -171,29 +171,29 @@ Hash_DeleteTable(Hash_Table *t) * Returns a pointer to the entry for key, or NULL if the table contains * no entry for the key. */ -Hash_Entry * -Hash_FindEntry(Hash_Table *t, const char *key) +HashEntry * +Hash_FindEntry(HashTable *t, const char *key) { unsigned int h = hash(key, NULL); return HashTable_Find(t, h, key); } void * -Hash_FindValue(Hash_Table *t, const char *key) +Hash_FindValue(HashTable *t, const char *key) { - Hash_Entry *he = Hash_FindEntry(t, key); + HashEntry *he = Hash_FindEntry(t, key); return he != NULL ? he->value : NULL; } /* Makes a new hash table that is larger than the old one. The entire hash * table is moved, so any bucket numbers from the old table become invalid. */ static void -RebuildTable(Hash_Table *t) +RebuildTable(HashTable *t) { - Hash_Entry *e, *next = NULL, **hp, **xp; + HashEntry *e, *next = NULL, **hp, **xp; int i; unsigned int mask, oldsize, newsize; - Hash_Entry **oldhp; + HashEntry **oldhp; oldhp = t->buckets; oldsize = t->bucketsSize; @@ -227,13 +227,13 @@ RebuildTable(Hash_Table *t) * newPtr Filled with TRUE if new entry created, * FALSE otherwise. */ -Hash_Entry * -Hash_CreateEntry(Hash_Table *t, const char *key, Boolean *newPtr) +HashEntry * +Hash_CreateEntry(HashTable *t, const char *key, Boolean *newPtr) { - Hash_Entry *e; + HashEntry *e; unsigned h; size_t keylen; - struct Hash_Entry **hp; + HashEntry **hp; h = hash(key, &keylen); e = HashTable_Find(t, h, key); @@ -267,9 +267,9 @@ Hash_CreateEntry(Hash_Table *t, const ch /* Delete the given hash table entry and free memory associated with it. */ void -Hash_DeleteEntry(Hash_Table *t, Hash_Entry *e) +Hash_DeleteEntry(HashTable *t, HashEntry *e) { - Hash_Entry **hp, *p; + HashEntry **hp, *p; for (hp = &t->buckets[e->namehash & t->bucketsMask]; (p = *hp) != NULL; hp = &p->next) { @@ -285,7 +285,7 @@ Hash_DeleteEntry(Hash_Table *t, Hash_Ent /* Set things up for iterating over all entries in the hash table. */ void -HashIter_Init(HashIter *hi, Hash_Table *t) +HashIter_Init(HashIter *hi, HashTable *t) { hi->table = t; hi->nextBucket = 0; @@ -294,11 +294,11 @@ HashIter_Init(HashIter *hi, Hash_Table * /* Return the next entry in the hash table, or NULL if the end of the table * is reached. */ -Hash_Entry * +HashEntry * HashIter_Next(HashIter *hi) { - Hash_Entry *e; - Hash_Table *t = hi->table; + HashEntry *e; + HashTable *t = hi->table; /* * The entry field points to the most recently returned @@ -322,8 +322,8 @@ HashIter_Next(HashIter *hi) } void -Hash_DebugStats(Hash_Table *t, const char *name) +Hash_DebugStats(HashTable *t, const char *name) { - DEBUG4(HASH, "Hash_Table %s: size=%u numEntries=%u maxchain=%u\n", + DEBUG4(HASH, "HashTable %s: size=%u numEntries=%u maxchain=%u\n", name, t->bucketsSize, t->numEntries, t->maxchain); } Index: src/usr.bin/make/hash.h diff -u src/usr.bin/make/hash.h:1.27 src/usr.bin/make/hash.h:1.28 --- src/usr.bin/make/hash.h:1.27 Sun Oct 18 10:44:25 2020 +++ src/usr.bin/make/hash.h Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: hash.h,v 1.27 2020/10/18 10:44:25 rillig Exp $ */ +/* $NetBSD: hash.h,v 1.28 2020/10/18 12:36:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -78,53 +78,53 @@ #define MAKE_HASH_H /* A single key-value entry in the hash table. */ -typedef struct Hash_Entry { - struct Hash_Entry *next; /* Used to link together all the entries +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 */ -} Hash_Entry; +} HashEntry; /* The hash table containing the entries. */ -typedef struct Hash_Table { - Hash_Entry **buckets; /* Pointers to Hash_Entry, one +typedef struct HashTable { + HashEntry **buckets; /* Pointers to HashEntry, one * for each bucket in the table. */ unsigned int bucketsSize; unsigned int numEntries; /* Number of entries in the table. */ unsigned int bucketsMask; /* Used to select the bucket for a hash. */ unsigned int maxchain; /* max length of chain detected */ -} Hash_Table; +} HashTable; /* State of an iteration over all entries in a table. */ typedef struct HashIter { - Hash_Table *table; /* Table being searched. */ + HashTable *table; /* Table being searched. */ unsigned int nextBucket; /* Next bucket to check (after current). */ - Hash_Entry *entry; /* Next entry to check in current bucket. */ + HashEntry *entry; /* Next entry to check in current bucket. */ } HashIter; static inline MAKE_ATTR_UNUSED void * -Hash_GetValue(Hash_Entry *h) +Hash_GetValue(HashEntry *h) { return h->value; } static inline MAKE_ATTR_UNUSED void -Hash_SetValue(Hash_Entry *h, void *datum) +Hash_SetValue(HashEntry *h, void *datum) { h->value = datum; } -void Hash_InitTable(Hash_Table *); -void Hash_DeleteTable(Hash_Table *); -Hash_Entry *Hash_FindEntry(Hash_Table *, const char *); -void *Hash_FindValue(Hash_Table *, const char *); -Hash_Entry *Hash_CreateEntry(Hash_Table *, const char *, Boolean *); -void Hash_DeleteEntry(Hash_Table *, Hash_Entry *); +void Hash_InitTable(HashTable *); +void Hash_DeleteTable(HashTable *); +HashEntry *Hash_FindEntry(HashTable *, const char *); +void *Hash_FindValue(HashTable *, const char *); +HashEntry *Hash_CreateEntry(HashTable *, const char *, Boolean *); +void Hash_DeleteEntry(HashTable *, HashEntry *); -void HashIter_Init(HashIter *, Hash_Table *); -Hash_Entry *HashIter_Next(HashIter *); +void HashIter_Init(HashIter *, HashTable *); +HashEntry *HashIter_Next(HashIter *); -void Hash_DebugStats(Hash_Table *, const char *); +void Hash_DebugStats(HashTable *, const char *); #endif /* MAKE_HASH_H */ Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.375 src/usr.bin/make/main.c:1.376 --- src/usr.bin/make/main.c:1.375 Sun Oct 18 11:54:43 2020 +++ src/usr.bin/make/main.c Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.375 2020/10/18 11:54:43 rillig Exp $ */ +/* $NetBSD: main.c,v 1.376 2020/10/18 12:36: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.375 2020/10/18 11:54:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.376 2020/10/18 12:36:43 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1957,7 +1957,7 @@ static void purge_cached_realpaths(void) { GNode *cache = get_cached_realpaths(); - Hash_Entry *he, *nhe; + HashEntry *he, *nhe; HashIter hi; HashIter_Init(&hi, &cache->context); Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.157 src/usr.bin/make/make.h:1.158 --- src/usr.bin/make/make.h:1.157 Sun Oct 18 11:09:08 2020 +++ src/usr.bin/make/make.h Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.157 2020/10/18 11:09:08 rillig Exp $ */ +/* $NetBSD: make.h,v 1.158 2020/10/18 12:36:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -345,7 +345,7 @@ typedef struct GNode { /* The "local" variables that are specific to this target and this target * only, such as $@, $<, $?. */ - Hash_Table context; + HashTable context; /* The commands to be given to a shell to create this target. */ StringList *commands; Index: src/usr.bin/make/targ.c diff -u src/usr.bin/make/targ.c:1.114 src/usr.bin/make/targ.c:1.115 --- src/usr.bin/make/targ.c:1.114 Sun Oct 18 08:24:01 2020 +++ src/usr.bin/make/targ.c Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: targ.c,v 1.114 2020/10/18 08:24:01 rillig Exp $ */ +/* $NetBSD: targ.c,v 1.115 2020/10/18 12:36:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -121,13 +121,13 @@ #include "dir.h" /* "@(#)targ.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: targ.c,v 1.114 2020/10/18 08:24:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: targ.c,v 1.115 2020/10/18 12:36:43 rillig Exp $"); static GNodeList *allTargets; /* the list of all targets found so far */ #ifdef CLEANUP static GNodeList *allGNs; /* List of all the GNodes */ #endif -static Hash_Table targets; /* a hash table of same */ +static HashTable targets; /* a hash table of same */ #ifdef CLEANUP static void TargFreeGN(void *); @@ -248,7 +248,7 @@ GNode * Targ_GetNode(const char *name) { Boolean isNew; - Hash_Entry *he = Hash_CreateEntry(&targets, name, &isNew); + HashEntry *he = Hash_CreateEntry(&targets, name, &isNew); if (!isNew) return Hash_GetValue(he); Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.575 src/usr.bin/make/var.c:1.576 --- src/usr.bin/make/var.c:1.575 Sun Oct 18 10:44:25 2020 +++ src/usr.bin/make/var.c Sun Oct 18 12:36:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.575 2020/10/18 10:44:25 rillig Exp $ */ +/* $NetBSD: var.c,v 1.576 2020/10/18 12:36: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.575 2020/10/18 10:44:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.576 2020/10/18 12:36:43 rillig Exp $"); #define VAR_DEBUG1(fmt, arg1) DEBUG1(VAR, fmt, arg1) #define VAR_DEBUG2(fmt, arg1, arg2) DEBUG2(VAR, fmt, arg1, arg2) @@ -233,7 +233,7 @@ ENUM_FLAGS_RTTI_6(VarFlags, */ typedef struct Var { /* The name of the variable, once set, doesn't change anymore. - * For context variables, it aliases the corresponding Hash_Entry name. + * For context variables, it aliases the corresponding HashEntry name. * For environment and undefined variables, it is allocated. */ const char *name; void *name_freeIt; @@ -428,7 +428,7 @@ VarFreeEnv(Var *v, Boolean destroy) static void VarAdd(const char *name, const char *val, GNode *ctxt, VarSet_Flags flags) { - Hash_Entry *he = Hash_CreateEntry(&ctxt->context, name, NULL); + HashEntry *he = Hash_CreateEntry(&ctxt->context, name, NULL); Var *v = VarNew(he->name, NULL, val, flags & VAR_SET_READONLY ? VAR_READONLY : 0); Hash_SetValue(he, v); @@ -442,7 +442,7 @@ void Var_Delete(const char *name, GNode *ctxt) { char *name_freeIt = NULL; - Hash_Entry *he; + HashEntry *he; if (strchr(name, '$') != NULL) { (void)Var_Subst(name, VAR_GLOBAL, VARE_WANTRES, &name_freeIt); @@ -574,7 +574,7 @@ Var_ExportVars(void) if (var_exportedVars == VAR_EXPORTED_ALL) { HashIter hi; - Hash_Entry *he; + HashEntry *he; /* Ouch! Exporting all variables at once is crazy... */ HashIter_Init(&hi, &VAR_GLOBAL->context); @@ -933,7 +933,7 @@ Var_Append(const char *name, const char ctxt->name, name, Buf_GetAll(&v->val, NULL)); if (v->flags & VAR_FROM_ENV) { - Hash_Entry *h; + HashEntry *h; /* * If the original variable came from the environment, we @@ -3858,7 +3858,7 @@ Var_Dump(GNode *ctxt) { Vector varnames; HashIter hi; - Hash_Entry *he; + HashEntry *he; size_t i; Vector_Init(&varnames);