[Asterisk-code-review] res stasis recording.c: Cleanup stasis app recording find by... (asterisk[master])

Richard Mudgett asteriskteam at digium.com
Wed Mar 30 16:30:00 CDT 2016


Richard Mudgett has uploaded a new change for review.

  https://gerrit.asterisk.org/2503

Change subject: res_stasis_recording.c: Cleanup stasis_app_recording_find_by_name().
......................................................................

res_stasis_recording.c: Cleanup stasis_app_recording_find_by_name().

Change-Id: Ic7d93c402c498677a122505558859c853d4e5ac7
---
M res/res_stasis_recording.c
1 file changed, 8 insertions(+), 10 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/03/2503/1

diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c
index dcabfa6..5482124 100644
--- a/res/res_stasis_recording.c
+++ b/res/res_stasis_recording.c
@@ -265,7 +265,13 @@
 	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
 };
 
@@ -465,15 +471,7 @@
 
 struct stasis_app_recording *stasis_app_recording_find_by_name(const char *name)
 {
-	RAII_VAR(struct stasis_app_recording *, recording, NULL, ao2_cleanup);
-
-	recording = ao2_find(recordings, name, OBJ_KEY);
-	if (recording == NULL) {
-		return NULL;
-	}
-
-	ao2_ref(recording, +1);
-	return recording;
+	return ao2_find(recordings, name, OBJ_KEY);
 }
 
 struct ast_json *stasis_app_recording_to_json(

-- 
To view, visit https://gerrit.asterisk.org/2503
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic7d93c402c498677a122505558859c853d4e5ac7
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>



More information about the asterisk-code-review mailing list