[svn-commits] kpfleming: trunk r89259 - in /trunk/main: channel.c pbx.c
SVN commits to the Digium repositories
svn-commits at lists.digium.com
Tue Nov 13 18:54:39 CST 2007
Author: kpfleming
Date: Tue Nov 13 18:54:38 2007
New Revision: 89259
URL: http://svn.digium.com/view/asterisk?view=rev&rev=89259
Log:
use simpler technique for removing known entries from lists
Modified:
trunk/main/channel.c
trunk/main/pbx.c
Modified: trunk/main/channel.c
URL: http://svn.digium.com/view/asterisk/trunk/main/channel.c?view=diff&rev=89259&r1=89258&r2=89259
==============================================================================
--- trunk/main/channel.c (original)
+++ trunk/main/channel.c Tue Nov 13 18:54:38 2007
@@ -1250,20 +1250,7 @@
int ast_channel_datastore_remove(struct ast_channel *chan, struct ast_datastore *datastore)
{
- struct ast_datastore *datastore2 = NULL;
- int res = -1;
-
- /* Find our position and remove ourselves */
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore2, entry) {
- if (datastore2 == datastore) {
- AST_LIST_REMOVE_CURRENT(entry);
- res = 0;
- break;
- }
- }
- AST_LIST_TRAVERSE_SAFE_END;
-
- return res;
+ return AST_LIST_REMOVE(&chan->datastores, datastore, entry) ? 0 : -1;
}
struct ast_datastore *ast_channel_datastore_find(struct ast_channel *chan, const struct ast_datastore_info *info, const char *uid)
Modified: trunk/main/pbx.c
URL: http://svn.digium.com/view/asterisk/trunk/main/pbx.c?view=diff&rev=89259&r1=89258&r2=89259
==============================================================================
--- trunk/main/pbx.c (original)
+++ trunk/main/pbx.c Tue Nov 13 18:54:38 2007
@@ -2103,17 +2103,11 @@
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)
More information about the svn-commits
mailing list