CK_HS_PUT_UNIQUE(3)
π CK_HS_PUT_UNIQUE(3) π
okay bestie, welcome to ck_hs_put_unique β the manual page, the moment, the main character of hash set inserts. this one lives in the Concurrency Kit library, aka libck, and you link it with -lck. slay. let's get into it π«Ά
πΈ NAME πΈ
ck_hs_put_unique β unconditionally store a unique key into a hash set. no cap. it just does the thing π
π LIBRARY π
Concurrency Kit (libck, -lck) β¨
π¦ SYNOPSIS π¦
#include <ck_hs.h>
bool
ck_hs_put_unique(ck_hs_t *hs, unsigned long hash, const void *key);
like. look at that signature. it's giving confident. it returns a bool, it takes a pointer to a ck_hs_t, it wants an unsigned long hash, and it wants a const void *key. periodt π
π DESCRIPTION π
so basically, the ck_hs_put_unique(3) function stores the key you pass in via the key argument into the hash set that hs points to. πΈ
and here's the little detail that matters, bestie: the key in key is expected to already have the hash value you pass in through the hash argument β and you get that number from the CK_HS_HASH(3) macro. it was previously generated with it, iykyk. don't just make one up, okay? π
now, if the call to ck_hs_put(3) was successful, then the key in key was successfully stored in the hash set pointed to by hs. π₯
β οΈ but listen. the function will cause undefined behavior if a key with an equivalent value is already present in the hash set. that's literally the whole point of the "unique" in the name, and it is not playing around π
if what you actually want is replacement semantics β like, swap the old one out, put the new one in β then go see the ck_hs_set(3) function instead. that's your girl for that job π
β¨ RETURN VALUES β¨
upon successful completion, ck_hs_put_unique(3) returns true π and otherwise it returns false on failure. simple. iconic. no notes.
π ERRORS π
- behavior is undefined if
keyorhsare uninitialized. please initialize your stuff, bestie, i'm begging π - the function will also return
falseif the hash set could not be enlarged to accomodate key insertion. (yes, the original says "accomodate" β we don't fix typos in this house, we respect the canon π) - the function will result in undefined behavior if it's called for an already inserted key value. do not do this. not even once. π ββοΈ
π SEE ALSO π
ck_hs_init(3)ck_hs_move(3)ck_hs_destroy(3)CK_HS_HASH(3)ck_hs_iterator_init(3)ck_hs_next(3)ck_hs_get(3)ck_hs_put(3)ck_hs_set(3)ck_hs_fas(3)ck_hs_remove(3)ck_hs_grow(3)ck_hs_rebuild(3)ck_hs_gc(3)ck_hs_count(3)ck_hs_reset(3)ck_hs_reset_size(3)ck_hs_stat(3)
additional information is available at http://concurrencykit.org/ β
and that's the whole page, bestie!! π§ this one came from the Concurrency Kit source, dated December 7, 2013 β a true vintage baddie π go forth and store your unique keys responsibly, ily, bye π«ΆπΈβ¨
π¦ 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