[asterisk-commits] rmudgett: trunk r314734 - /trunk/channels/sig_pri.c

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Apr 21 17:42:44 CDT 2011


Author: rmudgett
Date: Thu Apr 21 17:42:41 2011
New Revision: 314734

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=314734
Log:
Simplify sig_pri.c:build_status().

Modified:
    trunk/channels/sig_pri.c

Modified: trunk/channels/sig_pri.c
URL: http://svnview.digium.com/svn/asterisk/trunk/channels/sig_pri.c?view=diff&rev=314734&r1=314733&r2=314734
==============================================================================
--- trunk/channels/sig_pri.c (original)
+++ trunk/channels/sig_pri.c Thu Apr 21 17:42:41 2011
@@ -8668,18 +8668,10 @@
 	if (!s || len < 1) {
 		return;
 	}
-	s[0] = '\0';
-	if (!(status & DCHAN_NOTINALARM))
-		strncat(s, "In Alarm, ", len - strlen(s) - 1);
-	if (status & DCHAN_UP)
-		strncat(s, "Up", len - strlen(s) - 1);
-	else
-		strncat(s, "Down", len - strlen(s) - 1);
-	if (active)
-		strncat(s, ", Active", len - strlen(s) - 1);
-	else
-		strncat(s, ", Standby", len - strlen(s) - 1);
-	s[len - 1] = '\0';
+	snprintf(s, len, "%s%s, %s",
+		(status & DCHAN_NOTINALARM) ? "" : "In Alarm, ",
+		(status & DCHAN_UP) ? "Up" : "Down",
+		(active) ? "Active" : "Standby");
 }
 
 void sig_pri_cli_show_spans(int fd, int span, struct sig_pri_span *pri)




More information about the asterisk-commits mailing list