[Asterisk-code-review] chan_dahdi: Fix build with clang/llvm (...asterisk[17.0])

George Joseph asteriskteam at digium.com
Tue Sep 17 09:29:41 CDT 2019


George Joseph has submitted this change and it was merged. ( https://gerrit.asterisk.org/c/asterisk/+/12881 )

Change subject: chan_dahdi: Fix build with clang/llvm
......................................................................

chan_dahdi: Fix build with clang/llvm

On FreeBSD using the clang/llvm compiler build fails to build due
to the switch statement argument being a non integer type expression.
Switch to an if/else if/else construct to sidestep the issue.

ASTERISK-28536 #close

Change-Id: Idf4a82cc1e94580a2d017fe9e351c226f23e20c8
---
M channels/chan_dahdi.c
1 file changed, 6 insertions(+), 4 deletions(-)

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



diff --git a/channels/chan_dahdi.c b/channels/chan_dahdi.c
index 0fff4b1..1fca4ba 100644
--- a/channels/chan_dahdi.c
+++ b/channels/chan_dahdi.c
@@ -15158,10 +15158,12 @@
 			int channo;
 			int prev_channo;
 			x++;
-			switch (mfcr2->r2master) {
-			case 0L: thread_status = "zero"; break;
-			case AST_PTHREADT_NULL: thread_status = "none"; break;
-			default: thread_status = "created"; break;
+			if (mfcr2->r2master == 0L) {
+				thread_status = "zero";
+			} else if (mfcr2->r2master == AST_PTHREADT_NULL) {
+				thread_status = "none";
+			} else {
+				thread_status = "created";
 			}
 			snprintf(index, sizeof(index), "%d", mfcr2->index);
 			snprintf(live_chans_str, sizeof(live_chans_str), "%d", mfcr2->live_chans);

-- 
To view, visit https://gerrit.asterisk.org/c/asterisk/+/12881
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 17.0
Gerrit-Change-Id: Idf4a82cc1e94580a2d017fe9e351c226f23e20c8
Gerrit-Change-Number: 12881
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Sean Bright <sean.bright at gmail.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20190917/11e736f6/attachment.html>


More information about the asterisk-code-review mailing list