summaryrefslogtreecommitdiff
path: root/main/framehook.c
diff options
context:
space:
mode:
authorTerry Wilson <twilson@digium.com>2012-02-20 23:43:27 +0000
committerTerry Wilson <twilson@digium.com>2012-02-20 23:43:27 +0000
commit57f42bd74f78d5022631b2ba2269892f8a3a384a (patch)
tree3283ec4ac88c5b3c267f4490b410e5331911f2bb /main/framehook.c
parent25e5eb3b96e6d9bcbb2fc02fbd879ae21104c1f5 (diff)
ast_channel opaquification of pointers and integral types
Review: https://reviewboard.asterisk.org/r/1753/ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@356042 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/framehook.c')
-rw-r--r--main/framehook.c20
1 files changed, 11 insertions, 9 deletions
diff --git a/main/framehook.c b/main/framehook.c
index 2d5fd5a47..14f619866 100644
--- a/main/framehook.c
+++ b/main/framehook.c
@@ -90,6 +90,7 @@ static struct ast_frame *framehook_list_push_event(struct ast_framehook_list *fr
int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interface *i)
{
struct ast_framehook *framehook;
+ struct ast_framehook_list *fh_list;
struct ast_frame *frame;
if (i->version != AST_FRAMEHOOK_INTERFACE_VERSION) {
ast_log(LOG_ERROR, "Version '%hu' of framehook interface not what we compiled against (%hu)\n",
@@ -103,13 +104,14 @@ int ast_framehook_attach(struct ast_channel *chan, struct ast_framehook_interfac
framehook->chan = chan;
/* create the framehook list if it didn't already exist */
- if (!chan->framehooks && !(chan->framehooks = ast_calloc(1, sizeof(*chan->framehooks)))) {
+ if (!ast_channel_framehooks(chan) && !(fh_list = ast_calloc(1, sizeof(*ast_channel_framehooks(chan))))) {
ast_free(framehook);
return -1;
}
- framehook->id = ++chan->framehooks->id_count;
- AST_LIST_INSERT_TAIL(&chan->framehooks->list, framehook, list);
+ ast_channel_framehooks_set(chan, fh_list);
+ framehook->id = ++ast_channel_framehooks(chan)->id_count;
+ AST_LIST_INSERT_TAIL(&ast_channel_framehooks(chan)->list, framehook, list);
/* Tell the event callback we're live and rocking */
frame = framehook->i.event_cb(framehook->chan, NULL, AST_FRAMEHOOK_EVENT_ATTACHED, framehook->i.data);
@@ -128,11 +130,11 @@ int ast_framehook_detach(struct ast_channel *chan, int id)
struct ast_framehook *framehook;
int res = -1;
- if (!chan->framehooks) {
+ if (!ast_channel_framehooks(chan)) {
return res;
}
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->framehooks->list, framehook, list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_channel_framehooks(chan)->list, framehook, list) {
if (framehook->id == id) {
/* we mark for detachment rather than doing explicitly here because
* it needs to be safe for this function to be called within the
@@ -152,16 +154,16 @@ int ast_framehook_list_destroy(struct ast_channel *chan)
{
struct ast_framehook *framehook;
- if (!chan->framehooks) {
+ if (!ast_channel_framehooks(chan)) {
return 0;
}
- AST_LIST_TRAVERSE_SAFE_BEGIN(&chan->framehooks->list, framehook, list) {
+ AST_LIST_TRAVERSE_SAFE_BEGIN(&ast_channel_framehooks(chan)->list, framehook, list) {
AST_LIST_REMOVE_CURRENT(list);
framehook_detach_and_destroy(framehook);
}
AST_LIST_TRAVERSE_SAFE_END;
- ast_free(chan->framehooks);
- chan->framehooks = NULL;
+ ast_free(ast_channel_framehooks(chan));
+ ast_channel_framehooks_set(chan, NULL);
return 0;
}