diff options
author | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-06-25 15:10:35 -0400 |
---|---|---|
committer | Nalin Dahyabhai <nalin.dahyabhai@pobox.com> | 2008-06-25 15:10:35 -0400 |
commit | 231400ce0c648334529718c53835abfd30bd3eaa (patch) | |
tree | ceb1dba08e0821f310b25f47592b7251755e3213 /src/map.c | |
parent | 6c18db5fafe415dda3d70af40d0b55348e40ff1f (diff) | |
download | slapi-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.c | 7 |
1 files changed, 3 insertions, 4 deletions
@@ -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; |