EC_HTABLE_ITER(3)
π EC_HTABLE_ITER β bestie we're gonna walk the whole hash table π
okay so this is part of the libecoli programmer's manual, and today's main character is ec_htable_iter β the little function that lets you stroll through every single element chillin' inside a hash table. no cap. πΆβοΈβ¨
πΈ NAME πΈ
ec_htable_iter β iterate the elements in the hash table. that's it, that's the vibe. π
β¨ SYNOPSIS β¨
#include <ecoli/htable.h>
struct ec_htable_elt_ref * ec_htable_iter(
const struct ec_htable *htable /* The hash table. */
);
so you pull in the header #include <ecoli/htable.h>, and then you call ec_htable_iter() handing it your hash table β that's the const struct ec_htable *htable argument, aka The hash table. β and it hands you back a struct ec_htable_elt_ref *. π
π¦ DESCRIPTION π¦
the typical usage is, like, literally this:
for (iter = ec_htable_iter(htable);
iter != NULL;
iter = ec_htable_iter_next(iter)) {
printf(" %s: %p0,
ec_htable_iter_get_key(iter),
ec_htable_iter_get_val(iter));
}
it's giving classic for-loop main character energy: kick it off with ec_htable_iter(htable), keep going while iter != NULL, and then scoot to the next one with ec_htable_iter_next(iter). inside the loop you grab the key with ec_htable_iter_get_key(iter) and the value with ec_htable_iter_get_val(iter). periodt. π
π«Ά RETURN VALUE π«Ά
you get back an iterator element, or NULL if the htable is empty. that's the whole tea. if it's NULL, bestie, there's nothing in there to iterate. π
π SEE ALSO π
squad goals, all of them, go read these too:
ec_htable_iter_get_key(3)ec_htable_iter_get_val(3)ec_htable_iter_next(3)ec_htable_has_key(3)ec_htable_len(3)ec_htable(3)ec_htable_force_seed(3)ec_htable_dup(3)ec_htable_iter_get_key_len(3)ec_htable_dump(3)ec_htable_del(3)ec_htable_set(3)ec_htable_get(3)ec_htable_free(3)
π COPYRIGHT π
Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.
okay that's the whole page, mwah π this came from the libecoli manual and it's dated 2026-06-11, page EC_HTABLE_ITER(3). go iterate something iconic, bestie, you got this π§β
π¦ where this page comes from
- fedora 44: libecoli-devel 0.11.7-1.fc44 Β· BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
- fedora 44: libecoli-devel 0.11.7-1.fc44 Β· BSD-3-Clause AND LicenseRef-Fedora-Public-Domain
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms