[asterisk-commits] oej: trunk r46582 - /trunk/main/loader.c

asterisk-commits at lists.digium.com asterisk-commits at lists.digium.com
Tue Oct 31 01:08:56 MST 2006


Author: oej
Date: Tue Oct 31 02:08:56 2006
New Revision: 46582

URL: http://svn.digium.com/view/asterisk?rev=46582&view=rev
Log:
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

Modified:
    trunk/main/loader.c

Modified: trunk/main/loader.c
URL: http://svn.digium.com/view/asterisk/trunk/main/loader.c?rev=46582&r1=46581&r2=46582&view=diff
==============================================================================
--- trunk/main/loader.c (original)
+++ trunk/main/loader.c Tue Oct 31 02:08:56 2006
@@ -871,23 +871,17 @@
 	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);
 }
 
 



More information about the asterisk-commits mailing list