CK_RHS_NEXT(3)

✨ ck_rhs_next β€” iterate to next entry in hash set ✨

okay bestie, we're in the ck_rhs_next page from the Concurrency Kit manual, and honestly? it's giving "tiny function, big responsibilities" πŸ’…


πŸ“š LIBRARY

Concurrency Kit, aka libck, link it with -lck. that's the whole vibe. πŸŽ€


πŸ¦‹ SYNOPSIS

#include <ck_rhs.h>

bool
ck_rhs_next(ck_rhs_t *hs, ck_rhs_iterator_t *iterator, void **entry);

πŸ’– DESCRIPTION

so ck_rhs_next(3) does one thing and it does it iconically: it bumps the iterator object that iterator points at, so it lands on the next non-empty hash set entry. like, it skips past all the empty slots because we do not have time for those. periodt.

and if ck_rhs_next(3) returns true? then the pointer that entry points at gets initialized to the current hash set key that the iterator object is sitting on. it's literally handing you the key. so generous of it. 🫢

⚠️ important, bestie: iterator is expected to have already been initialized using the ck_rhs_iterator_init(3) function, or statically initialized using CK_RHS_ITERATOR_INITIALIZER. you can't just roll up with a random uninitialized iterator and expect magic. that's not how any of this works. πŸ™ˆ

🌸 RETURN VALUES

  • if ck_rhs_next(3) returns true β€” slay! πŸŽ‰ the object that entry points at points to a valid hash set key. you're so back.
  • if ck_rhs_next(3) returns false β€” oop 😭 the value of the object that entry points at is undefined. do not look at it. do not touch it. it's not for you.

πŸ’€ ERRORS

behavior is undefined if iterator or hs are uninitialized. like, genuinely undefined. no promises, no guarantees, no nothing. consider this your vibe check warning. 🚨


πŸ‘‘ SEE ALSO

the whole squad, fr fr:

and if you want even more lore, additional information is available at http://concurrencykit.org/ 🌈


okay that's the whole page, you ate it up πŸ’… this one's from September 17, 2012 (yes it's been iconic since 2012, we love an ageless queen) and it lives under the name CK_RHS_NEXT(3). go forth and iterate, bestie πŸ¦‹βœ¨πŸŽ€

πŸ“¦ where this page comes from