EC_DICT_DUP(3)
π EC_DICT_DUP β the Libecoli Programmer's Manual β¨
okay bestie, sit down, hydrate, and let's talk about ec_dict_dup(3) β she's the clone-maker of the Libecoli dictionary world π§
πΈ NAME πΈ
ec_dict_dup β Duplicate a hash table. that's it, that's the whole job. she copies. she duplicates. she gives you a twin π
β¨ SYNOPSIS β¨
#include <ecoli/dict.h>
struct ec_dict * ec_dict_dup(
const struct ec_dict *dict /* The hash table. */
);
so you hand her dict, which is just a pointer to the hash table you want cloned, and she hands you back a fresh struct ec_dict *. literally the simplest relationship you'll ever have with a C function π
π¦ DESCRIPTION π¦
A reference counter is shared between the clones of hash tables so that the objects are freed only when the last reference is destroyed.
translation, because this part is IMPORTANT: when you clone a dict, all the clones are lowkey holding hands π«Ά they share one reference counter together. so nothing gets freed until every single last one of the references is gone. the last one standing does the cleanup. main character energy fr fr. so like, don't be out here thinking one ec_dict_free on one clone nukes the whole squad β it does NOT, and that's by design πβ¨
π RETURN VALUE π
The duplicated hash table, or NULL on error (errno is set).
so: success = you get your gorgeous duplicate dict. failure = NULL and errno gets set so you can go investigate what went wrong. check that return value bestie, i'm begging π
π SEE ALSO π
the whole friend group, go say hi:
ec_dict_iter(3)ec_dict_has_key(3)ec_dict_free(3)ec_dict_iter_get_val(3)ec_dict_len(3)ec_dict_del(3)ec_dict(3)ec_dict_set(3)ec_dict_get(3)ec_dict_dump(3)ec_dict_iter_next(3)ec_dict_iter_get_key(3)
iykyk π
π COPYRIGHT π
Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.
that's the whole page, no cap π this came out of libecoli and the manual page itself is dated 2026-06-11 β go forth and duplicate responsibly, mwah ππ
π¦ where this page comes from
- fedora 44: libecoli-devel 0.11.7-1.fc44 Β· BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
- fedora 44: libecoli-devel 0.11.7-1.fc44 Β· BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms