use get and set

This commit is contained in:
Love Hörnquist Åstrand
2011-11-21 17:38:46 -08:00
parent 3b38640e4b
commit 1d7c483db2

View File

@@ -426,7 +426,7 @@ _krb5_load_plugins(krb5_context context, const char *name, const char **paths)
} }
} }
module = heim_dict_copy_value(modules, s); module = heim_dict_get_value(modules, s);
if (module == NULL) { if (module == NULL) {
module = heim_dict_create(11); module = heim_dict_create(11);
if (module == NULL) { if (module == NULL) {
@@ -434,7 +434,8 @@ _krb5_load_plugins(krb5_context context, const char *name, const char **paths)
heim_release(s); heim_release(s);
return; return;
} }
heim_dict_add_value(modules, s, module); heim_dict_set_value(modules, s, module);
heim_release(module);
} }
heim_release(s); heim_release(s);
@@ -475,7 +476,7 @@ _krb5_load_plugins(krb5_context context, const char *name, const char **paths)
} }
/* check if already cached */ /* check if already cached */
p = heim_dict_copy_value(module, spath); p = heim_dict_get_value(module, spath);
if (p == NULL) { if (p == NULL) {
p = heim_alloc(sizeof(*p), "krb5-plugin", plug_dealloc); p = heim_alloc(sizeof(*p), "krb5-plugin", plug_dealloc);
if (p) if (p)
@@ -484,16 +485,15 @@ _krb5_load_plugins(krb5_context context, const char *name, const char **paths)
if (p->dsohandle) { if (p->dsohandle) {
p->path = heim_retain(spath); p->path = heim_retain(spath);
p->names = heim_dict_create(11); p->names = heim_dict_create(11);
heim_dict_add_value(module, spath, p); heim_dict_set_value(module, spath, p);
} }
heim_release(p);
} }
heim_release(spath); heim_release(spath);
heim_release(p);
free(path); free(path);
} }
closedir(d); closedir(d);
} }
heim_release(module);
HEIMDAL_MUTEX_unlock(&plugin_mutex); HEIMDAL_MUTEX_unlock(&plugin_mutex);
#endif /* HAVE_DLOPEN */ #endif /* HAVE_DLOPEN */
} }
@@ -548,7 +548,7 @@ search_modules(void *ctx, heim_object_t key, heim_object_t value)
{ {
struct iter_ctx *s = ctx; struct iter_ctx *s = ctx;
struct plugin2 *p = value; struct plugin2 *p = value;
struct plug *pl = heim_dict_copy_value(p->names, s->n); struct plug *pl = heim_dict_get_value(p->names, s->n);
struct common_plugin_method *cpm; struct common_plugin_method *cpm;
if (pl == NULL) { if (pl == NULL) {
@@ -565,15 +565,14 @@ search_modules(void *ctx, heim_object_t key, heim_object_t value)
if (ret) if (ret)
cpm = pl->dataptr = NULL; cpm = pl->dataptr = NULL;
} }
heim_dict_add_value(p->names, s->n, pl); heim_dict_set_value(p->names, s->n, pl);
heim_release(pl);
} else { } else {
cpm = pl->dataptr; cpm = pl->dataptr;
} }
if (cpm && cpm->version >= s->min_version) if (cpm && cpm->version >= s->min_version)
heim_array_append_value(s->result, pl); heim_array_append_value(s->result, pl);
heim_release(pl);
} }
static void static void
@@ -603,7 +602,7 @@ _krb5_plugin_run_f(krb5_context context,
HEIMDAL_MUTEX_lock(&plugin_mutex); HEIMDAL_MUTEX_lock(&plugin_mutex);
dict = heim_dict_copy_value(modules, m); dict = heim_dict_get_value(modules, m);
heim_release(m); heim_release(m);
if (dict == NULL) { if (dict == NULL) {
HEIMDAL_MUTEX_unlock(&plugin_mutex); HEIMDAL_MUTEX_unlock(&plugin_mutex);
@@ -620,8 +619,6 @@ _krb5_plugin_run_f(krb5_context context,
heim_dict_iterate_f(dict, search_modules, &s); heim_dict_iterate_f(dict, search_modules, &s);
heim_release(dict);
HEIMDAL_MUTEX_unlock(&plugin_mutex); HEIMDAL_MUTEX_unlock(&plugin_mutex);
s.ret = KRB5_PLUGIN_NO_HANDLE; s.ret = KRB5_PLUGIN_NO_HANDLE;