CK_RHS_PUT(3)
π CK_RHS_PUT(3) π
okay bestie, welcome to the CK_RHS_PUT(3) page, aka the "put ONE unique key in the hash set and do not be weird about it" function π
β¨ NAME β¨
ck_rhs_put β store unique key into a hash set π
π LIBRARY π
Concurrency Kit, aka libck, and you link it with -lck π₯
π§ SYNOPSIS π§
#include <ck_rhs.h>
bool
ck_rhs_put(ck_rhs_t *hs, unsigned long hash, const void *key);
πΈ DESCRIPTION πΈ
so the way that ck_rhs_put(3) works is: it stores the key you hand it in the key argument into the hash set that hs points at π
and here's the thing, the key you pass in is expected to already have the hash value you're passing as the hash argument. and where did that hash come from? you generated it earlier with the CK_RHS_HASH(3) macro. no cap. π
if the call to ck_rhs_put(3) went through successfully, then yep, your key is now living in the hash set pointed to by hs β¨
but it WILL fail if a key with an equivalent value to key is already chillin' in the hash set. it's a unique key situation, bestie, the set is not accepting duplicates π
want replacement semantics instead? like, overwrite the old one? that's a whole different function, go look at ck_rhs_set(3) π«Ά
β RETURN VALUES β
- on success,
ck_rhs_put(3)returnstrueπ - otherwise it returns
false, which is the failure case π
π ERRORS π
behavior is undefined ifkeyorhsare uninitialized. like, unhinged behavior. do not do this. π¨
the function will also return false if the hash set could not be enlarged to accommodate the insertion of key. sometimes the set just can't grow, and it's not you, it's the allocation π
π SEE ALSO π
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_put_unique(3)ck_rhs_get(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)
more info? it's literally at http://concurrencykit.org/ π
sign-off time π this page came out of the Concurrency Kit (libck) era, dated September 17, 2012, and it's CK_RHS_PUT(3) β go forth and store those unique keys, bestie, iykyk π
π¦ 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 2012-2013 Samy Al Bahra
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms