diff options
| author | Marc André Tanner <mat@brain-dump.org> | 2016-12-15 20:21:27 +0100 |
|---|---|---|
| committer | Marc André Tanner <mat@brain-dump.org> | 2017-01-16 19:46:07 +0100 |
| commit | 55f79e75f34ccf740d3f1c92ab35c604b067b01c (patch) | |
| tree | bb4fca4a9a5741ac6d9ea69b61495491bf3131c6 /map.h | |
| parent | 201c3ffa3724f635ba0c98f4acecbd4b8db293c1 (diff) | |
| download | vis-55f79e75f34ccf740d3f1c92ab35c604b067b01c.tar.gz vis-55f79e75f34ccf740d3f1c92ab35c604b067b01c.tar.xz | |
map: add map_leaf utility function
Tests whether the given prefix can be extended to exactly one map element
i.e. true iff the prefix map contains exactly one element.
Diffstat (limited to 'map.h')
| -rw-r--r-- | map.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -17,6 +17,9 @@ void *map_closest(const Map*, const char *prefix); /* check whether the map contains the given prefix, i.e. whether it can * be extended to match a key of an element stored in the map. */ bool map_contains(const Map*, const char *prefix); +/* Test whether the given prefix can be extended to exactly one map element + * i.e. true iff the prefix map contains exactly one element. */ +bool map_leaf(const Map*, const char *prefix); /* Place a member in the map. This returns false if we run out of memory * (errno = ENOMEM), or if that key already appears in the map (errno = EEXIST). */ bool map_put(Map*, const char *key, const void *value); |
