diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-14 00:54:38 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2007-11-14 00:54:38 +0000 |
commit | cdae4a5591b4f166891ae1c94842a3838dff6328 (patch) | |
tree | ea2278dbcdc050b8a4e5b2f72d5c58d988314aab /main/channel.c | |
parent | cc34f5c17ee680c37563223bee3d8880bebbc28c (diff) |
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
Diffstat (limited to 'main/channel.c')
-rw-r--r-- | main/channel.c | 15 |
1 files changed, 1 insertions, 14 deletions
diff --git a/main/channel.c b/main/channel.c index 288d759f2..c914b6b7b 100644 --- a/main/channel.c +++ b/main/channel.c @@ -1250,20 +1250,7 @@ int ast_channel_datastore_add(struct ast_channel *chan, struct ast_datastore *da 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) |