hsearch_r

Name

hsearch_r -- search a hash table, reentrantly

Synopsis

#include <search.h>

int hsearch_r(ENTRY item, ACTION action, ENTRY * * retval, struct hsearch_data * htab);

Description

The hsearch_r() is a reentrant version of the hsearch() function, but instead of operating on a single global hash table, hsearch_r() operates on the table described by the object that htab references. This object can be initialized with the function hcreate_r().

Unlike the hsearch() function, hsearch_r() returns a pointer to the found entry in the variable referred to by retval, rather than directly.

Return Value

On success, hsearch_r() shall return a non-zero value.

On failure, hsearch_r() shall return 0 and set errno to an appropriate value.

Errors

ENOMEM 

action was set to ENTER, but the table was full.

ESRCH 

action was set to FIND, but no matching element was found in the table.