summaryrefslogtreecommitdiffstats
path: root/src
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
parent57a39a97fcc0e03b88364f57245a4faf4e142c74 (diff)
- add a way to iterate through domain names
Diffstat (limited to 'src')
-rw-r--r--src/map.c16
-rw-r--r--src/map.h3
2 files changed, 19 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. */
diff --git a/src/map.h b/src/map.h
index 5f7749b..3230df3 100644
--- a/src/map.h
+++ b/src/map.h
@@ -99,6 +99,9 @@ bool_t map_data_foreach_entry_id(struct plugin_state *state,
void *backend_data,
void *cbdata),
void *cbdata);
+bool_t map_data_foreach_domain(struct plugin_state *state,
+ bool_t (*fn)(const char *domain, void *cbdata),
+ void *cbdata);
bool_t map_data_foreach_map(struct plugin_state *state, const char *domain_name,
bool_t (*fn)(const char *domain,
const char *map,