CK_HT_NEXT(3)

πŸ’– CK_HT_NEXT(3) πŸ’–

okay so bestie, this is the page for ck_ht_next β€” the one from the CK_HT_NEXT(3) manual β€” and it's literally the "gimme the next one" function. no cap, it's giving little engine that could, but for hash tables. πŸš‚βœ¨


🌸 NAME 🌸

ck_ht_next β€” iterate to next entry in hash table


πŸŽ€ LIBRARY πŸŽ€

Concurrency Kit (libck, -lck)

like. link against it. that's the vibe. πŸ’…


✨ SYNOPSIS ✨

#include <ck_ht.h>

bool
ck_ht_next(ck_ht_t *ht, ck_ht_iterator_t *iterator,
    ck_ht_entry_t **entry);

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea β˜• β€” ck_ht_next() bumps the iterator object that iterator points at forward, so it lands on the next non-empty hash table entry. skipping the empty ones, iconic behaviour, we love a function that doesn't waste our time. πŸ’…

and if ck_ht_next() returns true?? then the pointer that entry points to gets initialized to the current hash table entry that the iterator object is pointing at. slay. 🫢

🚨 bestie listen β€” it is expected that iterator has already been initialized with the ck_ht_iterator_init(3) function, or statically initialized using CK_HT_ITERATOR_INITIALIZER. do not just roll up with a random uninitialized iterator, that's not the move. πŸ™ˆ

πŸ’« RETURN VALUES πŸ’«

  • if ck_ht_next() returns true β†’ the object pointed to by entry points to a valid hash table entry. go off. πŸ”₯
  • if ck_ht_next() returns false β†’ the value of the object pointed to by entry is undefined. 😭 so like, don't look at it. avert your eyes. it's giving void.

πŸ’€ ERRORS πŸ’€

Behavior is undefined if iterator or ht are uninitialized. fr fr. undefined behaviour is not a cute look, it's the main character dying in episode 3. πŸͺ¦


πŸ‘‘ SEE ALSO πŸ‘‘

the whole squad, all of them, no one left behind 🫢:

Additional information available at http://concurrencykit.org/ 🌈


and that's the whole page bestie, we ate and left no crumbs πŸ’–βœ¨

this one's from the Concurrency Kit source, dated March 30, 2012 β€” yeah she's vintage, she's a classic, she's been slaying since 2012 and she's still here. periodt. πŸ‘‘πŸŽ€

πŸ“¦ where this page comes from