mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-03 19:28:53 +00:00
Change ast_hangup() to return void and be NULL safe.
Since ast_hangup() is effectively a channel destructor, it should be a void function. * Make the few silly callers checking the return value no longer do so. Only the CDR and CEL unit tests checked the return value. * Make all callers take advantage of the NULL safe change and remove the NULL check before the call. git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@394623 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -139,23 +139,17 @@ static void do_sleep(void)
|
||||
} while (0)
|
||||
|
||||
/*! \brief Hang up a test channel safely */
|
||||
#define HANGUP_CHANNEL(channel, cause, hangup_extra) do { \
|
||||
ast_channel_hangupcause_set((channel), (cause)); \
|
||||
ao2_ref(channel, +1); \
|
||||
if (!ast_hangup((channel))) { \
|
||||
#define HANGUP_CHANNEL(channel, cause, hangup_extra) \
|
||||
do { \
|
||||
ast_channel_hangupcause_set((channel), (cause)); \
|
||||
ao2_ref(channel, +1); \
|
||||
ast_hangup(channel); \
|
||||
APPEND_EVENT(channel, AST_CEL_HANGUP, NULL, hangup_extra, NULL); \
|
||||
APPEND_EVENT(channel, AST_CEL_CHANNEL_END, NULL, NULL, NULL); \
|
||||
ao2_cleanup(stasis_cache_get_extended(ast_channel_topic_all_cached(), \
|
||||
ast_channel_snapshot_type(), ast_channel_uniqueid(channel), 1)); \
|
||||
ao2_cleanup(channel); \
|
||||
channel = NULL; \
|
||||
} else { \
|
||||
APPEND_EVENT(channel, AST_CEL_HANGUP, NULL, hangup_extra, NULL); \
|
||||
APPEND_EVENT(channel, AST_CEL_CHANNEL_END, NULL, NULL, NULL); \
|
||||
ao2_cleanup(stasis_cache_get_extended(ast_channel_topic_all_cached(), \
|
||||
ast_channel_snapshot_type(), ast_channel_uniqueid(channel), 1)); \
|
||||
ao2_cleanup(channel); \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
static int append_expected_event(
|
||||
|
Reference in New Issue
Block a user