make(1): use tabs for indentation in hash.h and hash.c
This commit is contained in:
parent
18dd66ad3f
commit
4a7b365ec7
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hash.c,v 1.57 2020/11/14 21:29:44 rillig Exp $ */
|
||||
/* $NetBSD: hash.c,v 1.58 2020/11/23 17:59:21 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -74,7 +74,7 @@
|
|||
#include "make.h"
|
||||
|
||||
/* "@(#)hash.c 8.1 (Berkeley) 6/6/93" */
|
||||
MAKE_RCSID("$NetBSD: hash.c,v 1.57 2020/11/14 21:29:44 rillig Exp $");
|
||||
MAKE_RCSID("$NetBSD: hash.c,v 1.58 2020/11/23 17:59:21 rillig Exp $");
|
||||
|
||||
/*
|
||||
* The ratio of # entries to # buckets at which we rebuild the table to
|
||||
|
@ -98,7 +98,7 @@ hash(const char *key, size_t *out_keylen)
|
|||
unsigned int
|
||||
Hash_Hash(const char *key)
|
||||
{
|
||||
return hash(key, NULL);
|
||||
return hash(key, NULL);
|
||||
}
|
||||
|
||||
static HashEntry *
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hash.h,v 1.33 2020/11/14 21:29:44 rillig Exp $ */
|
||||
/* $NetBSD: hash.h,v 1.34 2020/11/23 17:59:21 rillig Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
|
||||
|
@ -79,40 +79,40 @@
|
|||
|
||||
/* A single key-value entry in the hash table. */
|
||||
typedef struct HashEntry {
|
||||
struct HashEntry *next; /* Used to link together all the entries
|
||||
struct HashEntry *next; /* Used to link together all the entries
|
||||
* associated with the same bucket. */
|
||||
void *value;
|
||||
unsigned int key_hash; /* hash value of the key */
|
||||
char key[1]; /* key string, variable length */
|
||||
void *value;
|
||||
unsigned int key_hash; /* hash value of the key */
|
||||
char key[1]; /* key string, variable length */
|
||||
} HashEntry;
|
||||
|
||||
/* The hash table containing the entries. */
|
||||
typedef struct HashTable {
|
||||
HashEntry **buckets; /* Pointers to HashEntry, one
|
||||
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 */
|
||||
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 */
|
||||
} HashTable;
|
||||
|
||||
/* State of an iteration over all entries in a table. */
|
||||
typedef struct HashIter {
|
||||
HashTable *table; /* Table being searched. */
|
||||
unsigned int nextBucket; /* Next bucket to check (after current). */
|
||||
HashEntry *entry; /* Next entry to check in current bucket. */
|
||||
HashTable *table; /* Table being searched. */
|
||||
unsigned int nextBucket; /* Next bucket to check (after current). */
|
||||
HashEntry *entry; /* Next entry to check in current bucket. */
|
||||
} HashIter;
|
||||
|
||||
MAKE_INLINE void *
|
||||
HashEntry_Get(HashEntry *h)
|
||||
{
|
||||
return h->value;
|
||||
return h->value;
|
||||
}
|
||||
|
||||
MAKE_INLINE void
|
||||
HashEntry_Set(HashEntry *h, void *datum)
|
||||
{
|
||||
h->value = datum;
|
||||
h->value = datum;
|
||||
}
|
||||
|
||||
void HashTable_Init(HashTable *);
|
||||
|
|
Loading…
Reference in New Issue