summaryrefslogtreecommitdiffstats
path: root/src/map.c
diff options
context:
space:
mode:
authorNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-25 15:10:35 -0400
committerNalin Dahyabhai <nalin.dahyabhai@pobox.com>2008-06-25 15:10:35 -0400
commit231400ce0c648334529718c53835abfd30bd3eaa (patch)
treeceb1dba08e0821f310b25f47592b7251755e3213 /src/map.c
parent6c18db5fafe415dda3d70af40d0b55348e40ff1f (diff)
downloadslapi-nis-231400ce0c648334529718c53835abfd30bd3eaa.tar.gz
slapi-nis-231400ce0c648334529718c53835abfd30bd3eaa.tar.xz
slapi-nis-231400ce0c648334529718c53835abfd30bd3eaa.zip
- don't force the map initialization caller to even bother guessing about the
number of keys we'll need
Diffstat (limited to 'src/map.c')
-rw-r--r--src/map.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/map.c b/src/map.c
index 73d1550..903a9db 100644
--- a/src/map.c
+++ b/src/map.c
@@ -686,7 +686,6 @@ void
map_data_set_map(struct plugin_state *state,
const char *domain_name,
const char *map_name,
- unsigned int n_keys,
bool_t secure,
void *backend_data,
void (*free_backend_data)(void *backend_data))
@@ -743,8 +742,8 @@ map_data_set_map(struct plugin_state *state,
map = &maps[domain->n_maps];
memset(map, 0, sizeof(*map));
map->name = strdup(map_name);
- map->key_trees = malloc(n_keys * sizeof(void *));
- map->n_key_trees = n_keys;
+ map->key_trees = malloc(sizeof(void *));
+ map->n_key_trees = (map->key_trees != NULL) ? 1 : 0;
map->secure = secure;
map->backend_data = backend_data;
map->free_backend_data = free_backend_data;
@@ -755,7 +754,7 @@ map_data_set_map(struct plugin_state *state,
sizeof(*map) * domain->n_maps);
/* Clear the key tree set. */
memset(map->key_trees, 0,
- n_keys * sizeof(void *));
+ map->n_key_trees * sizeof(void *));
/* Switcheroo. */
free(domain->maps);
domain->maps = maps;