*** UNIX MANUAL PAGE BROWSER ***

A Nergahak database for man pages research.

Navigation

Directory Browser

1Browse 4.4BSD4.4BSD
1Browse Digital UNIXDigital UNIX 4.0e
1Browse FreeBSDFreeBSD 14.3
1Browse MINIXMINIX 3.4.0rc6-d5e4fc0
1Browse NetBSDNetBSD 10.1
1Browse OpenBSDOpenBSD 7.7
1Browse UNIX v7Version 7 UNIX
1Browse UNIX v10Version 10 UNIX

Manual Page Search

Manual Page Result

0 Command: hdestroy_r | Section: 3 | Source: Digital UNIX | File: hdestroy_r.3.gz
hsearch(3) Library Functions Manual hsearch(3) NAME hsearch, hcreate, hdestroy, hsearch_r, hcreate_r, hdestroy_r - Manage hash tables LIBRARY Standard C Library (libc.so, libc.a) SYNOPSIS #include <search.h> ENTRY *hsearch( ENTRY item, ACTION action); int hcreate( size_t nel); void hdestroy(void); int hsearch_r( ENTRY item, ACTION action, ENTRY **tar- get, struct hsearch_data *hsearch_data); int hcreate_r( size_t nel, struct hsearch_data *hsearch_data); void hdestroy_r( struct hsearch_data *hsearch_data); STANDARDS Interfaces documented on this reference page conform to industry stan- dards as follows: hsearch(), hcreate(), hdestroy(): XPG4, XPG4-UNIX Refer to the standards(5) reference page for more information about in- dustry standards and associated tags. PARAMETERS Identifies a structure of the type ENTRY as defined in the search.h header file. It contains two pointers: Points to the comparison key string. Points to any other data associated with the char *key parame- ter. Pointers to types other than char should be cast as char *. Specifies a value for an ACTION enum type, which indicates what is to be done with an item key when it cannot be found in the hash table. The following two actions can be specified for this parameter: Enter the key specified by the item parameter into the hash table at the appropriate place. When the table is full, a null pointer is returned. Do not enter the item key into the table, but return a null pointer when an item key can- not be found in the hash table. Specifies an estimate of the maximum number of entries that the hash table will contain. Un- der some circumstances, the hcreate() function may make the hash table larger than specified to obtain mathematically favorable conditions for access to the hash table. Points to the item ac- tually found. Consists of data for the hash table. DESCRIPTION The hsearch(), hcreate(), and hdestroy() functions are used to manage hash table operations: The hcreate() function initializes the hash ta- ble. You must call the hcreate() function before calling the hsearch() function. The hsearch() function searches a hash table. It returns a pointer into a hash table that indicates where a given entry can be found. The hsearch() function uses open addressing with a hash func- tion. The hdestroy() function deletes the hash table. This allows you to start a new hash table because only one table may be active at a time. After the call to hdestroy(), the hash table data should no longer be considered accessible. [Digital] The hsearch_r(), hcreate_r(), and hdestroy_r() functions are reentrant versions of hsearch(), hcreate(), and hdestroy(). Upon suc- cessful completion, the hsearch_r() function returns 0 (zero). Upon failure, it returns -1 and sets errno. [Digital] Threads can share hash tables by using the hcreate_r, hsearch_r, and hdestroy_r functions with a common hsearch_data value. To prevent corruption of data when sharing a hash table, locks must be used around calls that use the common hsearch_data value. RETURN VALUES The hsearch() function returns a null pointer when the action parameter is FIND and the key pointed to by item cannot be found or when the specified action is ENTER and the hash table is full. Upon successful completion, the hcreate() function returns a nonzero value. Otherwise, when sufficient space for the table cannot be allo- cated, the hcreate() function returns a value of 0 (zero). ERRORS If any of the following conditions occur, the hsearch() function sets errno to the corresponding value: The table is full. [Digital] The search failed. RELATED INFORMATION Functions: bsearch(3), lsearch(3), tsearch(3), qsort(3) Standards: standards(5) delim off hsearch(3)

Navigation Options