EC_HTABLE_GET(3)

✨ EC_HTABLE_GET ✨

okay bestie, welcome to EC_HTABLE_GET(3) from the Libecoli Programmer's Manual πŸ’– this one is short and sweet but she is important, so pay attention.


🌸 NAME 🌸

ec_htable_get β€” get a value from the hash table. that's it. that's the whole job. she fetches. she serves. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

first, the include. you gotta include her or she will not show up, no cap:

#include <ecoli/htable.h>

and here's the whole function, in all her glory ✨

void * ec_htable_get(
    const struct ec_htable   *htable,   /* The hash table. */
    const void               *key,      /* The key. */
    size_t                    key_len   /* The key length. */
);

three args, three vibes:

  • htable β€” the hash table. the main character. the const struct ec_htable * you're pulling from.
  • key β€” the key. a const void *, so she doesn't really care what shape your key is, she's just holding it.
  • key_len β€” the key length, a size_t. the way that she literally needs to know how many bytes of key she's looking at… yeah. tell her.

πŸ¦‹ RETURN VALUE πŸ¦‹

so what comes back?

  • if the element is found, you get the element. slay. πŸŽ‰
  • if there's an error, you get NULL, and errno is set.
  • and here's the spicy bit: if it succeeds but the element itself is NULL, then errno is set to 0. 🫠
so like, NULL does NOT automatically mean error, bestie. you have to actually check errno to know which universe you're in. it's giving "looks the same, means different things" energy. 😭

πŸ‘‘ SEE ALSO πŸ‘‘

go read her friends too, they're all iconic in their own way:


Copyright (C) 2010-2026 Olivier Matz, Robin Jarry.


and that's the whole page, bestie 🧚 go get that value πŸ’–

this has been libecoli, dated 2026-06-11, and you have officially read EC_HTABLE_GET(3) all the way to the end πŸŽ€β­ mwah πŸ’‹

πŸ“¦ where this page comes from