res_stasis: Reduce RAII_VAR usage.

In addition to being a micro-optimization (RAII_VAR has overhead), this
change improves output of REF_DEBUG.  Unfortunately when RAII_VAR calls
ao2_cleanup it does so from a generated _dtor_varname function.  For
example this caused _dtor_app to release a reference instead of
__stasis_app_unregister.

Change-Id: I4ce67120583a446babf9adeec678b71d37fcd9e5
This commit is contained in:
Corey Farrell
2018-01-06 03:17:15 -05:00
parent 26e5edd043
commit 55a540272f
5 changed files with 323 additions and 172 deletions

View File

@@ -250,7 +250,7 @@ static int bridge_stasis_moving(struct ast_bridge_channel *bridge_channel, void
{
if (src->v_table == &bridge_stasis_v_table &&
dst->v_table != &bridge_stasis_v_table) {
RAII_VAR(struct stasis_app_control *, control, NULL, ao2_cleanup);
struct stasis_app_control *control;
struct ast_channel *chan;
chan = bridge_channel->chan;
@@ -263,6 +263,7 @@ static int bridge_stasis_moving(struct ast_bridge_channel *bridge_channel, void
stasis_app_channel_set_stasis_end_published(chan);
app_send_end_msg(control_app(control), chan);
ao2_ref(control, -1);
}
return -1;