summaryrefslogtreecommitdiffstats
path: root/src/map.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-07-02 10:41:42 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-07-02 10:41:42 -0400
commit6ad428cd3abca4b790edbc98003b00588766e16c (patch)
tree45a6b6f93ca0f30ddbe28b17300a2b586079c55b /src/map.c
parent57a39a97fcc0e03b88364f57245a4faf4e142c74 (diff)
- add a way to iterate through domain names
Diffstat (limited to 'src/map.c')
-rw-r--r--src/map.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/map.c b/src/map.c
index b361fe2..4a4b7a8 100644
--- a/src/map.c
+++ b/src/map.c
@@ -299,6 +299,22 @@ map_data_foreach_entry_id(struct plugin_state *state,
return map_data_foreach_entry(state, domain, map, id, fn, cbdata);
}
+/* Iterate over all domains, calling the callback with information about the
+ * domain. */
+bool_t
+map_data_foreach_domain(struct plugin_state *state,
+ bool_t (*fn)(const char *domain, void *cbdata),
+ void *cbdata)
+{
+ int i, j;
+ for (i = 0; i < map_data.n_domains; i++) {
+ if (!(*fn)(map_data.domains[i].name, cbdata)) {
+ return FALSE;
+ }
+ }
+ return TRUE;
+}
+
/* Iterate over all maps, calling the callback with information about the map
* and whatever the caller originally told us to keep track of when the map was
* first set up. */