wofi-map(3)
β¨ NAME β¨
wofi β the Map API functions and docs, bestie π (this is the wofi-map(3) page, in case the vibe check didn't tell you)
π¦ DESCRIPTION π¦
okay so. the functions we're about to spill about are the ones you use to vibe with wofi's config and map. they live in map.h, no cap. πβ¨
π MAP FUNCTIONS π
these are the girlies you call to mess with a struct map* π
struct map* map_init(void)β allocates and hands you back a brand new string map. heads up tho: string maps only support string values, that's the whole thing, periodt. πstruct map* map_init_void(void)β allocates and hands you back a brand new void map. a void map is the flexible one, she supports values of any type. main character energy fr fr. πvoid map_free(struct map* map)β frees the map you gave it plus all its keys. now listen: values only get freed if it's a string map. so if you're on a void map, the values are your problem, not hers. πbool map_put(struct map* map, const char* key, char* value)β returnstrueif the map you passed is a string map. otherwise it returnsfalseand prints a message tostderr. πstruct map* mapβ the map you're inserting into.const char* keyβ the key the value gets stored under. this key gets handed tostrdup()before it's saved, and it'll be freed when you runmap_free().char* valueβ the value you're storing. this value gets handed tostrdup()before it's saved and will be freed when you runmap_free(). if the value isNULLit will not be given tostrdup(). π
bool map_put_void(struct map* map, const char* key, void* value)β returnstrueif the map you passed is a void map. otherwisefalseplus a message printed tostderr. πstruct map* mapβ the map you're inserting into.const char* keyβ the key the value gets stored under. it's given tostrdup()before being saved and will be freed when you runmap_free().void* valueβ the value to store. this pointer just gets stored in the map, so it's on the caller to free this and it will not be freed when you runmap_free(). lowkey important, don't forget her. π«Ά
void* map_get(struct map* map, const char* key)β returns the value stored under key, orNULLif no such key exists. also:NULLcan come back even when it was stored there viamap_put()ormap_put_void(). so yeah,NULLis giving ambiguous, sorry bestie. πstruct map* mapβ the map you're getting the value from.const char* keyβ the key to look up.
bool map_contains(struct map* map, const char* key)β returnstrueif the key exists,falseotherwise. this one is implemented as avalue != NULLcheck, which means aNULLvalue is considered to not exist. yes really. that's the rule. βstruct map* mapβ the map you're checking against.const char* keyβ the key you're checking for.
size_t map_size(struct map* map)β returns the number of entries in this map. the headcount, the roster, the guest list. π₯struct map* mapβ the map you want the size of.
tiny reminder thatmap_putonly slays on string maps andmap_put_voidonly slays on void maps β mismatch meansfalseplus a lil message onstderr, so read your errors, i'm begging π₯Ί
and that's the whole page, babe! this was wofi-map(3) from the Library Functions Manual β signed, sealed, and dated as wofi-map(3) at the bottom. go forth and map responsibly πβ¨
π¦ where this page comes from
- alpine 3.24: wofi-doc 1.5.3-r0 Β· GPL-3.0-only
- arch rolling: wofi 1.5.3-1 Β· GPL-3.0-or-later
- debian bookworm: wofi 1.3-1 Β· GPL-3.0-or-later
- debian trixie: wofi 1.4.1-1+b2 Β· GPL-3.0-or-later
- fedora 43: wofi-devel 1.4.1-7.fc43 Β· GPL-3.0-only
- fedora 43: wofi-devel 1.4.1-7.fc43 Β· GPL-3.0-only
- fedora 43: wofi-devel 1.5.3-1.fc43 Β· GPL-3.0-only
- fedora 43: wofi-devel 1.5.3-1.fc43 Β· GPL-3.0-only
- fedora 44: wofi-devel 1.5.3-2.fc44 Β· GPL-3.0-only
- fedora 44: wofi-devel 1.5.3-2.fc44 Β· GPL-3.0-only
- nixos 26.05: wofi 1.5.3
- nixpkgs unstable: wofi 1.5.3
- opensuse-leap 16.0: wofi 1.4.1-bp160.1.13 Β· GPL-3.0-only
- opensuse-leap 16.0: wofi 1.4.1-bp160.1.13 Β· GPL-3.0-only
- opensuse-leap 16.0: wofi 1.4.1-bp160.1.13 Β· GPL-3.0-only
- opensuse-leap 16.0: wofi 1.4.1-bp160.1.13 Β· GPL-3.0-only
- ubuntu jammy: wofi 1.2.4-1 Β· GPL-3.0-or-later
- ubuntu noble: wofi 1.4.1-1build2 Β· GPL-3.0-or-later
- ubuntu questing: wofi 1.4.1-1build2
- ubuntu resolute: wofi 1.5.1-1 Β· GPL-3.0-or-later
- ubuntu stonking: wofi 1.5.3-1 Β· GPL-3.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms