This is the hash table control structure. It keeps track of information about a hash table, as well as the hash table itself. Notes:
- Pointer to the hash table proper. The table is an array of pointers to hash nodes (of type hnode_t). If the table is empty, every element of this table is a null pointer. A non-null entry points to the first element of a chain of nodes.
- This member keeps track of the size of the hash table—that is, the number of chain pointers.
- The count member maintains the number of elements that are presently in the hash table.
- The maximum count is the greatest number of nodes that can populate this table. If the table contains this many nodes, no more can be inserted, and the hash_isfull() function returns true.
- The high mark is a population threshold, measured as a number of nodes, which, if exceeded, will trigger a table expansion. Only dynamic hash tables are subject to this expansion.
- The low mark is a minimum population threshold, measured as a number of nodes. If the table population drops below this value, a table shrinkage will occur. Only dynamic tables are subject to this reduction. No table will shrink beneath a certain absolute minimum number of nodes.
- This is the a pointer to the hash table's comparison function. The function is set once at initialization or creation time.
- Pointer to the table's hashing function, set once at creation or initialization time.
- The current hash table mask. If the size of the hash table is 2^N, this value has its low N bits set to 1, and the others clear. It is used to select bits from the result of the hashing function to compute an index into the table.
- A flag which indicates whether the table is to be dynamically resized. It is set to 1 in dynamically allocated tables, 0 in tables that are statically allocated.