==> include/mesh/strmap.h <==1/* @ajax/mesh-strmap: a map from strings to strings, kept sorted by key (bytewise, as Rust's
2 * BTreeMap<String, String> orders), so iterating it is in Rust's order. */
3#ifndef MESH_STRMAP_H
4#define MESH_STRMAP_H
5
6#include <stdbool.h>
7#include <stddef.h>
8
9typedef struct {
10 char **k, **v;
11 size_t n, cap;
12} ms_map;
13
14const char *ms_get(const ms_map *m, const char *key); /* NULL when absent */
15/* Sets key to value (copies). Returns false (changing nothing) if the key existed and !replace. */
16bool ms_set(ms_map *m, const char *key, const char *value, bool replace);
17bool ms_del(ms_map *m, const char *key);
18void ms_free(ms_map *m);
19
20#endif