[asterisk-commits] cdr.c: Replace inlined code with ao2 t replace() (asterisk[13])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 9 16:37:28 CDT 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6702 )

Change subject: cdr.c: Replace inlined code with ao2_t_replace()
......................................................................

cdr.c: Replace inlined code with ao2_t_replace()

Change-Id: I9f424f5282ca7d833592f958d95f1b2bafb549b0
---
M main/cdr.c
1 file changed, 2 insertions(+), 10 deletions(-)

Approvals:
  Corey Farrell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/main/cdr.c b/main/cdr.c
index e09efe2..c3f3139 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -751,11 +751,7 @@
  */
 static void cdr_object_snapshot_copy(struct cdr_object_snapshot *dst, struct cdr_object_snapshot *src)
 {
-	if (dst->snapshot) {
-		ao2_t_ref(dst->snapshot, -1, "release old snapshot during copy");
-	}
-	dst->snapshot = src->snapshot;
-	ao2_t_ref(dst->snapshot, +1, "bump new snapshot during copy");
+	ao2_t_replace(dst->snapshot, src->snapshot, "CDR snapshot copy");
 	strcpy(dst->userfield, src->userfield);
 	dst->flags = src->flags;
 	copy_variables(&dst->variables, &src->variables);
@@ -1358,11 +1354,7 @@
 		struct ast_channel_snapshot *new_snapshot)
 {
 	cdr_object_update_cid(old_snapshot, new_snapshot);
-	if (old_snapshot->snapshot) {
-		ao2_t_ref(old_snapshot->snapshot, -1, "Drop ref for swap");
-	}
-	ao2_t_ref(new_snapshot, +1, "Bump ref for swap");
-	old_snapshot->snapshot = new_snapshot;
+	ao2_t_replace(old_snapshot->snapshot, new_snapshot, "Swap CDR shapshot");
 }
 
 /* BASE METHOD IMPLEMENTATIONS */

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

Gerrit-Project: asterisk
Gerrit-Branch: 13
Gerrit-MessageType: merged
Gerrit-Change-Id: I9f424f5282ca7d833592f958d95f1b2bafb549b0
Gerrit-Change-Number: 6702
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20171009/6ac3b392/attachment-0001.html>


More information about the asterisk-commits mailing list