}
/* Get rid of each of the data stores on the channel */
- AST_LIST_LOCK(&chan->datastores);
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore, list) {
- /* Remove from the list */
- AST_LIST_REMOVE_CURRENT(&chan->datastores, list);
+ while ((datastore = AST_LIST_REMOVE_HEAD(&chan->datastores, entry)))
/* Free the data store */
ast_channel_datastore_free(datastore);
- }
- AST_LIST_TRAVERSE_SAFE_END
- AST_LIST_UNLOCK(&chan->datastores);
- AST_LIST_HEAD_DESTROY(&chan->datastores);
+ AST_LIST_HEAD_INIT_NOLOCK(&chan->datastores);
/* loop over the variables list, freeing all data and deleting list items */
/* no need to lock the list, as the channel is already locked */
{
int res = 0;
- AST_LIST_LOCK(&chan->datastores);
- AST_LIST_INSERT_HEAD(&chan->datastores, datastore, list);
- AST_LIST_UNLOCK(&chan->datastores);
+ AST_LIST_INSERT_HEAD(&chan->datastores, datastore, entry);
return res;
}
int res = -1;
/* Find our position and remove ourselves */
- AST_LIST_LOCK(&chan->datastores);
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore2, list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore2, entry) {
if (datastore2 == datastore) {
- AST_LIST_REMOVE_CURRENT(&chan->datastores, list);
+ AST_LIST_REMOVE_CURRENT(&chan->datastores, entry);
res = 0;
break;
}
}
AST_LIST_TRAVERSE_SAFE_END
- AST_LIST_UNLOCK(&chan->datastores);
return res;
}
if (info == NULL)
return NULL;
- AST_LIST_LOCK(&chan->datastores);
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore, list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->datastores, datastore, entry) {
if (datastore->info == info) {
if (uid != NULL && datastore->uid != NULL) {
if (!strcasecmp(uid, datastore->uid)) {
}
}
AST_LIST_TRAVERSE_SAFE_END
- AST_LIST_UNLOCK(&chan->datastores);
return datastore;
}
}
/* Move data stores over */
if (AST_LIST_FIRST(&clone->datastores))
- AST_LIST_INSERT_TAIL(&original->datastores, AST_LIST_FIRST(&clone->datastores), list);
+ AST_LIST_INSERT_TAIL(&original->datastores, AST_LIST_FIRST(&clone->datastores), entry);
AST_LIST_HEAD_INIT_NOLOCK(&clone->datastores);
clone_variables(original, clone);
/*! Data store type information */
const struct ast_datastore_info *info;
/*! Used for easy linking */
- AST_LIST_ENTRY(ast_datastore) list;
+ AST_LIST_ENTRY(ast_datastore) entry;
};
/*! Structure for all kinds of caller ID identifications */
struct ast_channel_spy_list *spies;
/*! Data stores on the channel */
- AST_LIST_HEAD(datastores, ast_datastore) datastores;
+ AST_LIST_HEAD_NOLOCK(datastores, ast_datastore) datastores;
/*! For easy linking */
AST_LIST_ENTRY(ast_channel) chan_list;