Manages hash tables.
Standard C Library (libc.a)
ENTRY *hsearch ( Item, Action)
int hcreate ( NumberOfElements)
void hdestroy ( )
Attention: Do not use the hsearch, hcreate, or hdestroy subroutine in a multithreaded environment.
The hsearch subroutine searches a hash table. It returns a pointer into a hash table that indicates the location of the given item. The hsearch subroutine uses open addressing with a multiplicative hash function.
The hcreate subroutine allocates sufficient space for the table. You must call the hcreate subroutine before calling the hsearch subroutine. The NumberOfElements parameter is an estimate of the maximum number of entries that the table will contain. This number may be adjusted upward by the algorithm in order to obtain certain mathematically favorable circumstances.
The hdestroy subroutine deletes the hash table. This action allows you to start a new hash table since only one table can be active at a time. After the call to the hdestroy subroutine, the data can no longer be considered accessible.
|Identifies a structure of the type ENTRY as defined in the search.h file. It contains two pointers:
|Specifies the value of the Action enumeration parameter that
indicates what is to be done with an entry if it cannot be found in the
table. Values are:
|Provides an estimate of the maximum number of entries that the table contains. Under some circumstances, the hcreate subroutine may actually make the table larger than specified.
The hcreate subroutine returns a value of 0 if it cannot allocate sufficient space for the table.
These subroutines are part of Base Operating System (BOS) Runtime.
The bsearch (bsearch Subroutine) subroutine, lsearch (lsearch or lfind Subroutine) subroutine, malloc (malloc, free, realloc, calloc, mallopt, mallinfo, alloca, or valloc Subroutine) subroutine, strcmp subroutine, tsearch subroutine.
Searching and Sorting Example Program and Subroutines Overview in AIX 5L Version 5.1 General Programming Concepts: Writing and Debugging Programs.