[asterisk-commits] cdr.c: Replace redundant check with an ast assert() (asterisk[14])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Oct 9 19:51:36 CDT 2017


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

Change subject: cdr.c: Replace redundant check with an ast_assert()
......................................................................

cdr.c: Replace redundant check with an ast_assert()

The only caller of cdr_object_fn_table.process_party_b() explicitly does
the check before calling.

Change-Id: Ib0c53cdf5048227842846e0df9d2c19117c45618
---
M main/cdr.c
1 file changed, 5 insertions(+), 8 deletions(-)

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



diff --git a/main/cdr.c b/main/cdr.c
index 4bcfc05..f313f0b 100644
--- a/main/cdr.c
+++ b/main/cdr.c
@@ -1626,11 +1626,9 @@
 static void dial_state_process_party_b(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
 {
 	ast_assert(snapshot != NULL);
+	ast_assert(cdr->party_b.snapshot
+		&& !strcasecmp(cdr->party_b.snapshot->name, snapshot->name));
 
-	if (!cdr->party_b.snapshot
-		|| strcasecmp(cdr->party_b.snapshot->name, snapshot->name)) {
-		return;
-	}
 	cdr_object_swap_snapshot(&cdr->party_b, snapshot);
 
 	/* If party B hangs up, finalize this CDR */
@@ -1826,10 +1824,9 @@
 
 static void bridge_state_process_party_b(struct cdr_object *cdr, struct ast_channel_snapshot *snapshot)
 {
-	if (!cdr->party_b.snapshot
-		|| strcasecmp(cdr->party_b.snapshot->name, snapshot->name)) {
-		return;
-	}
+	ast_assert(cdr->party_b.snapshot
+		&& !strcasecmp(cdr->party_b.snapshot->name, snapshot->name));
+
 	cdr_object_swap_snapshot(&cdr->party_b, snapshot);
 
 	/* If party B hangs up, finalize this CDR */

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

Gerrit-Project: asterisk
Gerrit-Branch: 14
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib0c53cdf5048227842846e0df9d2c19117c45618
Gerrit-Change-Number: 6707
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20171009/6531e1d7/attachment-0001.html>


More information about the asterisk-commits mailing list