---
name: "wofi-map"
section: "3"
platform: "linux"
package: "wofi"
version: "1.5.3-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/wofi-map"
---

# wofi-map(3)

Map API functions and documentation

## NAME

wofi - Map API functions and documentation

## DESCRIPTION

The functions documented here are used for interacting with wofi's config and map. They are defined in map.h.

## MAP FUNCTIONS

The following functions are used to interact with a **struct map\***

- **struct map\* map\_init(void)**

  Allocates and returns a new string map. String maps only support string values.

- **struct map\* map\_init\_void(void)**

  Allocates and returns a new void map. A void map supports values of any type.

- **void map\_free(struct map\* map)**

  Frees the provided map and all it's keys. Values are only freed if it is a string map.

- **bool map\_put(struct map\* map, const char\* key, char\* value)**

  Returns true if the given map is a string map, otherwise returns false and prints a message to stderr.

  **struct map\* map** - The map to insert into.

  **const char\* key** - The key to store the value under. This key is given to **strdup()** before being saved and will be freed when running **map\_free()**.

  **char\* value** - The value to store. This value is given to **strdup()** before being saved and will be freed when running **map\_free()**. If the value is **NULL** it will not be given to **strdup()**.

- **bool map\_put\_void(struct map\* map, const char\* key, void\* value)**

  Returns true if the given map is a void map, otherwise returns false and prints a message to stderr.

  **struct map\* map** - The map to insert into.

  **const char\* key** - The key to store the value under. This key is given to **strdup()** before being saved and will be freed when running **map\_free()**.

  **void\* value** - The value to store. This pointer is stored in the map, it is on the caller to free this and it will not be freed when running **map\_free()**.

- **void\* map\_get(struct map\* map, const char\* key)**

  Returns the value stored under **key** or **NULL** if no key exists. **NULL** can also be returned if it was stored there with **map\_put()** or **map\_put\_void()**.

  **struct map\* map** - The map to get the value from.

  **const char\* key** - The key to lookup.

- **bool map\_contains(struct map\* map, const char\* key)**

  Returns true if the key exists, false otherwise. This is implemented as a **value != NULL** check so a **NULL** value is considered to not exist.

  **struct map\* map** - The map to check against.

  **const char\* key** - The key to check for.

- **size\_t map\_size(struct map\* map)**

  Returns the number of entries in this map.

  **struct map\* map** - The map to get the size of.
