diff options
| author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-07-02 10:41:42 -0400 |
|---|---|---|
| committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-07-02 10:41:42 -0400 |
| commit | 6ad428cd3abca4b790edbc98003b00588766e16c (patch) | |
| tree | 45a6b6f93ca0f30ddbe28b17300a2b586079c55b /src | |
| parent | 57a39a97fcc0e03b88364f57245a4faf4e142c74 (diff) | |
- add a way to iterate through domain names
Diffstat (limited to 'src')
| -rw-r--r-- | src/map.c | 16 | ||||
| -rw-r--r-- | src/map.h | 3 |
2 files changed, 19 insertions, 0 deletions
@@ -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. */ @@ -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, |
