EC_HTABLE_SET(3)

NAME
ec_htable_set - Add/replace an object in the hash table.

SYNOPSIS
#include <ecoli/htable.h>

int ec_htable_set(
    struct ec_htable     *htable,   /* The hash table. */
    const void           *key,      /* The key. */
    size_t                key_len,  /* The key length. */
    void                 *val,      /* The pointer to be saved in the hash table. */
    /*
     * An optional pointer to a destructor function called when an object is
     * destroyed (ec_htable_del() or ec_htable_free()).
     */
    ec_htable_elt_free_t  free_cb
);

RETURN VALUE

0 on success, or -1 on error (errno is set). On error, the passed value is freed (free_cb(val) is called).

SEE ALSO

ec_htable_iter_get_key(3), ec_htable_iter_get_val(3), ec_htable_iter_next(3), ec_htable_has_key(3), ec_htable_len(3), ec_htable(3), ec_htable_force_seed(3), ec_htable_dup(3), ec_htable_iter_get_key_len(3), ec_htable_dump(3), ec_htable_del(3), ec_htable_get(3), ec_htable_free(3), ec_htable_iter(3)

COPYRIGHT

Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.