man rhash_insert (Fonctions bibliothèques) - allocate a new rhash

NAME

rhash_insert - allocate a new rhash

SYNOPSIS

#include <roy.h>

void rhash_insert (RHash *hash, void *entry, void *key);

DESCRIPTION

Inserts a new entry into a hash table. The entry structure is defined by the user, and should contain the macro 'RHASH_HEADER'. See rhash(3) for information on how to create a compatible RHashEntry structure.

key is of the type as defined by the compare and hash functions provided at RHash creation time. See rhash(3) for details. This function also sets key as the key for entry; the equivalent of calling rhash_entry_setkey(3). The key is stored as a void * pointer within the RHASH_HEADER; no copy of the key is made.

RETURN VALUE

This function doesn't return a value.

DUPLICATE ENTRIES

If an entry is inserted into the hash table with a key of an entry that already exists in the hash table, they will both be added and no error condition will exist. Any calls thereafter to rhash_lookup(3) will return the first entry inserted with that key.

If you do not wish to have multiple entries with the same key, you must do a rhash_lookup(3) prior to inserting the new entry.

SEE ALSO