summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-04 16:22:55 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-04 16:22:55 -0400
commit761006cea186bf1fba9d4935667e9d6bd7ca67e7 (patch)
tree47e0055a103dc1d475041ef3227ee684c140df44 /src
parent2587019fff06097e6c026058d23d91bdac71cba0 (diff)
- add a function to check if there's an entry for a given ID in a given map
Diffstat (limited to 'src')
-rw-r--r--src/map.c13
-rw-r--r--src/map.h3
2 files changed, 16 insertions, 0 deletions
diff --git a/src/map.c b/src/map.c
index bdde29c..51f47d7 100644
--- a/src/map.c
+++ b/src/map.c
@@ -496,6 +496,19 @@ map_next(struct plugin_state *state,
return TRUE;
}
+/* Check if there's an entry with a specific ID. */
+bool_t
+map_data_check_entry(struct plugin_state *state,
+ const char *domain_name, const char *map_name,
+ const char *id)
+{
+ return (map_data_find_map_entry_id(state,
+ map_data_find_map(state,
+ domain_name,
+ map_name),
+ id) != NULL);
+}
+
/* Remove all of the entries in a map. */
static void
map_data_clear_map_map(struct plugin_state *state, struct map *map)
diff --git a/src/map.h b/src/map.h
index 017cb72..7460982 100644
--- a/src/map.h
+++ b/src/map.h
@@ -69,6 +69,9 @@ void map_data_set_entry(struct plugin_state *state,
const char *id, const char **related_ids,
unsigned int key_len, char *key,
unsigned int value_len, char *value);
+bool_t map_data_check_entry(struct plugin_state *state,
+ const char *domain_name, const char *map_name,
+ const char *id);
bool_t map_data_foreach_entry_id(struct plugin_state *state, const char *id,
bool_t (*fn)(const char *domain,
const char *map,