From cdae4a5591b4f166891ae1c94842a3838dff6328 Mon Sep 17 00:00:00 2001 From: kpfleming Date: Wed, 14 Nov 2007 00:54:38 +0000 Subject: use simpler technique for removing known entries from lists git-svn-id: http://svn.digium.com/svn/asterisk/trunk@89259 f38db490-d61c-443f-a65b-d21fe96a405b --- main/pbx.c | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) (limited to 'main/pbx.c') diff --git a/main/pbx.c b/main/pbx.c index 72a2ffa2d..cd2b27c82 100644 --- a/main/pbx.c +++ b/main/pbx.c @@ -2103,17 +2103,11 @@ int ast_custom_function_unregister(struct ast_custom_function *acf) return -1; AST_RWLIST_WRLOCK(&acf_root); - AST_RWLIST_TRAVERSE_SAFE_BEGIN(&acf_root, cur, acflist) { - if (cur == acf) { - AST_RWLIST_REMOVE_CURRENT(acflist); - ast_verb(2, "Unregistered custom function %s\n", acf->name); - break; - } - } - AST_RWLIST_TRAVERSE_SAFE_END; + if ((cur = AST_RWLIST_REMOVE(&acf_root, acf, acflist))) + ast_verb(2, "Unregistered custom function %s\n", cur->name); AST_RWLIST_UNLOCK(&acf_root); - return acf ? 0 : -1; + return cur ? 0 : -1; } int __ast_custom_function_register(struct ast_custom_function *acf, struct ast_module *mod) -- cgit v1.2.3