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

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 9 17:21:04 CDT 2017


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

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 4bcfc05..6a5b33c 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -754,11 +754,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);
@@ -1361,11 +1357,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/6703
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: merged
Gerrit-Change-Id: I9f424f5282ca7d833592f958d95f1b2bafb549b0
Gerrit-Change-Number: 6703
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/da22e7a1/attachment-0001.html>


More information about the asterisk-commits mailing list