]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
chan_dahdi: Fix build with clang/llvm
authorGuido Falsi <madpilot@FreeBSD.org>
Sat, 14 Sep 2019 15:05:23 +0000 (17:05 +0200)
committerGeorge Joseph <gjoseph@digium.com>
Mon, 16 Sep 2019 15:11:52 +0000 (10:11 -0500)
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

channels/chan_dahdi.c

index 0fff4b140177b2bd9f46993490e2ac99dcfdedc4..1fca4ba3cb811a7859b897750b9c9a473b04f4c9 100644 (file)
@@ -15158,10 +15158,12 @@ static void mfcr2_show_links_of(struct ast_cli_args *a, struct r2links *list_hea
                        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);