cdr.c: Replace redundant check with an ast_assert()
authorRichard Mudgett <rmudgett@digium.com>
Tue, 3 Oct 2017 21:09:58 +0000 (16:09 -0500)
committerRichard Mudgett <rmudgett@digium.com>
Mon, 9 Oct 2017 18:34:32 +0000 (13:34 -0500)
The only caller of cdr_object_fn_table.process_party_b() explicitly does
the check before calling.

Change-Id: Ib0c53cdf5048227842846e0df9d2c19117c45618

main/cdr.c

index 1817e80..0703f9e 100644 (file)
@@ -1623,11 +1623,9 @@ static int single_state_process_parking_bridge_enter(struct cdr_object *cdr, str
 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 */
@@ -1823,10 +1821,9 @@ static int dialed_pending_state_process_dial_begin(struct cdr_object *cdr, struc
 
 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 */