Merge "res_stasis_recording.c: Cleanup stasis_app_recording_find_by_name()." into 13

This commit is contained in:
Joshua Colp
2016-03-31 07:16:10 -05:00
committed by Gerrit Code Review

View File

@@ -265,7 +265,13 @@ static enum stasis_app_control_channel_result check_rule_recording(
return STASIS_APP_CHANNEL_RECORDING; return STASIS_APP_CHANNEL_RECORDING;
} }
struct stasis_app_control_rule rule_recording = { /*
* XXX This only works because there is one and only one rule in
* the system so it can be added to any number of channels
* without issue. However, as soon as there is another rule then
* watch out for weirdness because of cross linked lists.
*/
static struct stasis_app_control_rule rule_recording = {
.check_rule = check_rule_recording .check_rule = check_rule_recording
}; };
@@ -465,15 +471,7 @@ const char *stasis_app_recording_get_name(
struct stasis_app_recording *stasis_app_recording_find_by_name(const char *name) struct stasis_app_recording *stasis_app_recording_find_by_name(const char *name)
{ {
RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup); return ao2_find(recordings, name, OBJ_KEY);
recording = ao2_find(recordings, name, OBJ_KEY);
if (recording == NULL) {
return NULL;
}
ao2_ref(recording, +1);
return recording;
} }
struct ast_json *stasis_app_recording_to_json( struct ast_json *stasis_app_recording_to_json(