From 4cb296f155191a0de0d0a67995813526b6a4287b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Sun, 13 Sep 2015 17:35:30 +0200 Subject: map: introduce map_contains utility function --- map.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'map.h') diff --git a/map.h b/map.h index ed42393..078c9c6 100644 --- a/map.h +++ b/map.h @@ -12,6 +12,9 @@ void *map_get(const Map*, const char *key); /* Returns the corresponding value if the given prefix is unique. * Otherwise NULL, if no such prefix exists then errno is set to ENOENT. */ 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); /* 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); -- cgit v1.2.3