CK_RHS_PUT_UNIQUE(3)
π ck_rhs_put_unique β the "no dupes allowed" hash set baddie π
ok bestie, welcome to ck_rhs_put_unique(3) β it's giving main character energy from the Concurrency Kit (that's libck, and you link it with -lck, iykyk). This one stores a key in a hash set and it is unconditionally doing it, no thoughts, no checking, no chill. π¦
β¨ SYNOPSIS β¨
#include <ck_rhs.h>
bool
ck_rhs_put_unique(ck_rhs_t *hs, unsigned long hash, const void *key);
πΈ DESCRIPTION πΈ
so the way that ck_rhs_put_unique(3) works is: it stores the key you pass in key into the hash set that hs is pointing at. periodt. π
and listen β the key you hand over is expected to have the hash value you passed as hash. That hash? You already generated it earlier with the CK_RHS_HASH(3) macro. Don't skip that step bestie, it's literally the whole vibe. π
If the call to ck_rhs_put(3) succeeded, then yes β your key is officially in the hash set pointed to by hs, slay. π«Ά
β οΈ BUT. If a key with an equivalent value is already in the hash set, this function causes undefined behavior. Not a vibe. Not a warning. Just chaos. π
If you wanted replacement semantics β like, swap the old one out, new one in β that's a whole different girl, go look at ck_rhs_set(3) instead. π
π₯ RETURN VALUES π₯
- Success β
ck_rhs_put_unique(3)returnstrueβ¨ - Failure β it returns
falseπ
π ERRORS π
- If
keyorhsare uninitialized β undefined behavior. Please initialize your stuff, I am begging. π₯Ί - The function will also return
falseif the hash set could not be enlarged to accommodate the insertion ofkey. (yes, it tried to grow for you, it's an icon, it just couldn't) - If you call this for a key value that's already been inserted β undefined behavior. again. it's giving "I warned you." π
π SEE ALSO π
the whole friend group, go say hi:
ck_rhs_init(3)ck_rhs_move(3)ck_rhs_destroy(3)CK_RHS_HASH(3)ck_rhs_iterator_init(3)ck_rhs_next(3)ck_rhs_get(3)ck_rhs_put(3)ck_rhs_set(3)ck_rhs_fas(3)ck_rhs_remove(3)ck_rhs_grow(3)ck_rhs_rebuild(3)ck_rhs_gc(3)ck_rhs_count(3)ck_rhs_reset(3)ck_rhs_reset_size(3)ck_rhs_stat(3)
and if you want even more lore, the info is available at http://concurrencykit.org/ β
ok that's the whole page bestie, you ate that π this was CK_RHS_PUT_UNIQUE(3), dated December 7, 2013, brought to you by the Concurrency Kit girlies. go forth and store those unique keys, but fr fr β no duplicates. mwah. πβ¨π§
π¦ where this page comes from
- alpine 3.24: ck-doc 0.7.2-r1 Β· BSD-2-Clause AND Apache-2.0
- debian bookworm: libck-dev 0.7.1-10 Β· BSD-2-Clause
- debian trixie: libck-dev 0.7.2-6 Β· BSD-2-Clause
- epel 10: ck-devel 0.7.2-1.el10_1 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- epel 9: ck-devel 0.7.0-10.el9 Β· BSD
- fedora 43: ck-devel 0.7.2-2.fc43 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 43: ck-devel 0.7.2-2.fc43 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- fedora 44: ck-devel 0.7.2-4.fc44 Β· BSD-2-clause AND Apache-2.0 AND BSD-3-clause
- nixos 26.05: ck 0.7.2
- nixpkgs unstable: ck 0.7.2
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- opensuse-leap 16.0: ck-devel 0.7.2-bp160.1.9 Β· Apache-2.0 AND BSD-2-Clause
- ubuntu jammy: libck-dev 0.7.1-6ubuntu2 Β· BSD-2-Clause
- ubuntu noble: libck-dev 0.7.1-13build1 Β· BSD-2-Clause
- ubuntu questing: libck-dev 0.7.2-5ubuntu1
- ubuntu resolute: libck-dev 0.7.2-5ubuntu2 Β· BSD-2-Clause
- ubuntu stonking: libck-dev 0.7.2-11 Β· BSD-2-Clause
- Copyright 2013 Samy Al Bahra
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms