Hash_EnumFirst — C Library Procedures
NAME
Hash_EnumFirst, Hash_EnumNext − step through all the entries in a hash table
SYNOPSIS
#include <hash.h>
Hash_Entry ∗
Hash_EnumFirst(tablePtr, searchPtr)
Hash_Entry ∗
Hash_EnumNext(searchPtr)
ARGUMENTS
Hash_Table ∗tablePtr (in) Hash table whose entries are to be enumerated.
Hash_Search ∗searchPtr (in) Structure in which information can be stored about the state of the search between calls to Hash_EnumFirst and/or Hash_EnumNext.
DESCRIPTION
Hash_EnumFirst and Hash_EnumNext permit each of the entries in a hash table to be examined in order. Hash_EnumFirst returns the first entry in the given hash table and sets up the Hash_Search structure at ∗searchPtr; if the table is empty it returns NULL. Hash_EnumNext returns the next entry in the table using the information stored in ∗searchPtr, and updates the contents of ∗searchPtr; when the entire table has been scanned, it returns NULL. Entries are returned in order of their position in the table’s buckets, which does not usually make any sense to the caller.
A typical usage of these procedures is: Hash_Search search; Hash_Entry ∗entryPtr; Hash_Table table;
...
for (entryPtr = Hash_EnumFirst(&table, &search); entryPtr != NULL; entryPtr = Hash_EnumNext(&search)) {
... }
KEYWORDS
enumerate, hash table
Sprite version 1.0 — December 30, 1988