CK_HS_GET(3)

πŸ’– CK_HS_GET β€” bestie, let's go get that key πŸ’–

okay so real talk, this is a page from the Concurrency Kit manual, and the library you want is libck β€” link it with -lck and you're golden ✨


🌸 SYNOPSIS 🌸

#include <ck_hs.h>

void *
ck_hs_get(ck_hs_t *hs, unsigned long hash, const void *key);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so ck_hs_get(3) is literally the "hey do I know you?" function of the hash set world πŸ’…

It hands you back a pointer to a key inside the hash set hs that is of equivalent value to the object that key points at. So like, it's not necessarily the same object, it's the matching one, iykyk.

Now listen β€” the key you pass in as key is expected to already have the hash value you're passing as hash. And that hash? It's supposed to have been generated beforehand using the CK_HS_HASH(3) macro. No cap, don't just make one up πŸ™ˆ


πŸ‘‘ RETURN VALUES πŸ‘‘

  • If the key you handed over is a member of hs, you get back a pointer to the key as it's stored in hs. not a copy, the actual one, periodt.
  • If the key was not found in hs? You get NULL. that's it. that's the whole vibe check. 😭

πŸ’€ ERRORS πŸ’€

Behavior is undefined if entry or hs are uninitialized. bestie I am begging you, initialize your stuff first. undefined behavior is not the moment, fr fr. 🚨

πŸŽ€ SEE ALSO πŸŽ€

More info? It's all waiting for you at http://concurrencykit.org/ 🌈


and that's the whole page bestie 🫢 this one came out on September 17, 2012, from the Concurrency Kit crew β€” go forth, hash responsibly, and slay πŸ’…βœ¨

πŸ“¦ where this page comes from