[Asterisk-code-review] cdr.c: Replace inlined code with ao2 t replace() (asterisk[15])
    Jenkins2 
    asteriskteam at digium.com
       
    Mon Oct  9 17:00:00 CDT 2017
    
    
  
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/6704 )
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 1817e80..1a3ff87 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/6704
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: merged
Gerrit-Change-Id: I9f424f5282ca7d833592f958d95f1b2bafb549b0
Gerrit-Change-Number: 6704
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-code-review/attachments/20171009/4ccbe588/attachment.html>
    
    
More information about the asterisk-code-review
mailing list