aboutsummaryrefslogtreecommitdiffstats
path: root/main/loader.c
diff options
context:
space:
mode:
authoroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-31 08:08:56 +0000
committeroej <oej@f38db490-d61c-443f-a65b-d21fe96a405b>2006-10-31 08:08:56 +0000
commit30d943f918742fe5a262da11cc1162f3fa16ed09 (patch)
tree75eb606563208a9a5b0e6b4d55861ec644484743 /main/loader.c
parentce24885ff5ad2bd8cbd30f0c180fa78ac5828a0e (diff)
Take two, using find_resource on Kevin's suggestion.
Might need better locking support, giving up if we can't get the lock. Right now, using existing locking in find_resource git-svn-id: http://svn.digium.com/svn/asterisk/trunk@46582 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'main/loader.c')
-rw-r--r--main/loader.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/main/loader.c b/main/loader.c
index c0636142a..525eef415 100644
--- a/main/loader.c
+++ b/main/loader.c
@@ -871,23 +871,17 @@ int ast_update_module_list(int (*modentry)(const char *module, const char *descr
return total_mod_loaded;
}
+/*! \brief Check if module exists */
int ast_module_check(char *name)
{
struct ast_module *cur;
- int unlock = -1;
- int res = 0;
if (ast_strlen_zero(name))
return 0; /* FALSE */
- if (ast_mutex_trylock(&module_list.lock))
- unlock = 0;
- AST_LIST_TRAVERSE(&module_list, cur, entry)
- if (!res && !strcasecmp(name, cur->resource))
- res = 1;
- if (unlock)
- AST_LIST_UNLOCK(&module_list);
- return res;
+ cur = find_resource(name, 1);
+
+ return (cur != NULL);
}