mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	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
This commit is contained in:
		| @@ -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; | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user