From cd158d753a24f84a096d1c2211cd1da400a66036 Mon Sep 17 00:00:00 2001 From: Nalin Dahyabhai Date: Tue, 17 Jun 2008 16:41:04 -0400 Subject: - get most of the tree in shape to handle multiple keys per entry - make map_next() not expose entry IDs or key indices, because it has to do all of the heavy lifting anyway --- src/dummymap.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'src/dummymap.c') diff --git a/src/dummymap.c b/src/dummymap.c index ffb4ef7..cd36c15 100644 --- a/src/dummymap.c +++ b/src/dummymap.c @@ -219,13 +219,16 @@ map_match(struct plugin_state *state, bool_t map_match_id(struct plugin_state *state, const char *domain, const char *map, bool_t *secure, - const char *in_id, + const char *in_id, int in_index, unsigned int *key_len, char **key, unsigned int *value_len, char **value, const char **id) { struct entry *entries; int i; + if (in_index != 0) { + return FALSE; + } if ((entries = map_find_entries(domain, map)) == NULL) { return FALSE; } @@ -251,7 +254,7 @@ map_first(struct plugin_state *state, const char *domain, const char *map, bool_t *secure, unsigned int *first_key_len, char **first_key, unsigned int *first_value_len, char **first_value, - const char **first_id) + const char **first_id, int *first_id_index) { struct entry *entries; if ((entries = map_find_entries(domain, map)) == NULL) { @@ -266,6 +269,7 @@ map_first(struct plugin_state *state, *first_value = entries[0].value; *first_value_len = strlen(entries[0].value); *first_id = entries[0].id; + *first_id_index = 0; return TRUE; } @@ -274,8 +278,7 @@ map_next(struct plugin_state *state, const char *domain, const char *map, bool_t *secure, unsigned int prev_len, const char *prev, unsigned int *next_key_len, char **next_key, - unsigned int *next_value_len, char **next_value, - const char **next_id) + unsigned int *next_value_len, char **next_value) { struct entry *entries; int i; @@ -299,17 +302,16 @@ map_next(struct plugin_state *state, *next_key_len = strlen(entries[i + 1].key); *next_value = entries[i + 1].value; *next_value_len = strlen(entries[i + 1].value); - *next_id = entries[i + 1].id; return TRUE; } bool_t map_next_id(struct plugin_state *state, const char *domain, const char *map, bool_t *secure, - const char *prev_id, + const char *prev_id, int prev_id_index, unsigned int *next_key_len, char **next_key, unsigned int *next_value_len, char **next_value, - const char **next_id) + const char **next_id, int *next_id_index) { struct entry *entries; int i; @@ -333,5 +335,6 @@ map_next_id(struct plugin_state *state, *next_value = entries[i + 1].value; *next_value_len = strlen(entries[i + 1].value); *next_id = entries[i + 1].id; + *next_id_index = 0; return TRUE; } -- cgit