summaryrefslogtreecommitdiffstats
path: root/src/dummymap.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin@dahyabhai.net>2008-06-17 16:41:04 -0400
committerNalin Dahyabhai <nalin@dahyabhai.net>2008-06-17 16:41:04 -0400
commitcd158d753a24f84a096d1c2211cd1da400a66036 (patch)
tree332e0c12dc8e3cc7a8aa021e53aefa2a55ca85bf /src/dummymap.c
parent4f5e14211ff8238f62cb15186379b6b9ecffef51 (diff)
downloadslapi-nis-cd158d753a24f84a096d1c2211cd1da400a66036.tar.gz
slapi-nis-cd158d753a24f84a096d1c2211cd1da400a66036.tar.xz
slapi-nis-cd158d753a24f84a096d1c2211cd1da400a66036.zip
- 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
Diffstat (limited to 'src/dummymap.c')
-rw-r--r--src/dummymap.c17
1 files changed, 10 insertions, 7 deletions
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;
}