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

Joshua Colp asteriskteam at digium.com
Thu Mar 31 07:16:11 CDT 2016


Joshua Colp has submitted this change and it was merged.

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(-)

Approvals:
  Anonymous Coward #1000019: Verified
  Matt Jordan: Looks good to me, but someone else must approve
  Joshua Colp: Looks good to me, approved; Verified



diff --git a/res/res_stasis_recording.c b/res/res_stasis_recording.c
index 392d92c..05b97bf 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/2502
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: Ic7d93c402c498677a122505558859c853d4e5ac7
Gerrit-PatchSet: 1
Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-code-review mailing list