cp_hashlist_append_by_option(3) - Linux man page

Name

cp_hashlist_insert, cp_hashlist_insert_by_option, cp_hashlist_append, cp_hashlist_append_by_option - add a mapping to a hashlist

Synopsis

#include <cprops/hashlist.h>

void *cp_hashlist_insert(cp_hashlist *list, void *key, void *value);
void *cp_hashlist_insert_by_option(cp_hashlist *
list,

void *key, void *value, int mode);
void *cp_hashlist_append(cp_hashlist *
list, void *key, void *value);
void *cp_hashlist_append_by_option(cp_hashlist *
list, void *key, void *value, int mode);

Description

cp_hashlist_insert adds a mapping from key to value using the current mode on list. The new mapping is prepended to the list. The effect of various mode bits is as follows:

COLLECTION_MODE_DEEP - if a mapping for key already exists, the
destructor functions are called on the existing key and value and they are replaced with the new settings - unless COLLECTION_MODE_MULTIPLE_VALUES is set.
COLLECTION_MODE_MULTIPLE_VALUES - allows multiple mappings for a given
key.
COLLECTION_MODE_COPY - the copy functions specified on list creation
are used to store copies of the key and value.
COLLECTION_MODE_NOSYNC - no locking is performed on insertion.
COLLECTION_MODE_NORESIZE - a resize will not be triggered even if the
fill factor exceeds the maximum setting for the internal table.
cp_hashlist_insert_by_option allows specifying a mode setting overriding the current list mode, with the exception that the COLLECTION_MODE_NOSYNC bit on the option parameter has no effect.

cp_hashlist_append and cp_hashlist_append_by_option are similar to cp_hashlist_insert and cp_hashlist_insert_by_option respectively, with the difference that the new mapping is appended to the list.

Return Value

insertion functions return a pointer to the actual inserted value, which may be different to the value parameter if COLLECTION_MODE_COPY is set, or NULL if the insertion failed.

Errors

EINVAL the COLLECTION_MODE_MULTIPLE_VALUES mode bit is not set and

a mapping for key already exists
ENOMEM an internal allocation failed.

See Also

cp_hashlist(3), cp_hashlist_get(3), cp_hashlist_set_mode(3), cp_hashlist_set_max_fill_factor(3)