[svn-commits] russell: trunk r47520 - /trunk/channels/chan_iax2.c

svn-commits at lists.digium.com svn-commits at lists.digium.com
Sun Nov 12 12:22:20 MST 2006


Author: russell
Date: Sun Nov 12 13:22:19 2006
New Revision: 47520

URL: http://svn.digium.com/view/asterisk?view=rev&rev=47520
Log:
The use of an ifdef to check for FreeBSD is useless here because the two
versions of the format string are identical.  Also, since each format is only
used once, get rid of the use of defines all together.  (issue #8344, julieng)

In passing, also clean up the formatting a but to get rid of the nesting
without the use of braces, as defined in the coding guidelines.

Modified:
    trunk/channels/chan_iax2.c

Modified: trunk/channels/chan_iax2.c
URL: http://svn.digium.com/view/asterisk/trunk/channels/chan_iax2.c?view=diff&rev=47520&r1=47519&r2=47520
==============================================================================
--- trunk/channels/chan_iax2.c (original)
+++ trunk/channels/chan_iax2.c Sun Nov 12 13:22:19 2006
@@ -4222,30 +4222,22 @@
 
 static int iax2_show_firmware(int fd, int argc, char *argv[])
 {
-#define FORMAT2 "%-15.15s  %-15.15s %-15.15s\n"
-#if !defined(__FreeBSD__)
-#define FORMAT "%-15.15s  %-15d %-15d\n"
-#else /* __FreeBSD__ */
-#define FORMAT "%-15.15s  %-15d %-15d\n" /* XXX 2.95 ? */
-#endif /* __FreeBSD__ */
 	struct iax_firmware *cur = NULL;
 
 	if ((argc != 3) && (argc != 4))
 		return RESULT_SHOWUSAGE;
 
+	ast_cli(fd, "%-15.15s  %-15.15s %-15.15s\n", "Device", "Version", "Size");
 	AST_LIST_LOCK(&firmwares);
-	
-	ast_cli(fd, FORMAT2, "Device", "Version", "Size");
-	AST_LIST_TRAVERSE(&firmwares, cur, list)
-		if ((argc == 3) || (!strcasecmp(argv[3], (char *)cur->fwh->devname))) 
-			ast_cli(fd, FORMAT, cur->fwh->devname, ntohs(cur->fwh->version),
-				(int)ntohl(cur->fwh->datalen));
-
+	AST_LIST_TRAVERSE(&firmwares, cur, list) {
+		if ((argc == 3) || (!strcasecmp(argv[3], (char *)cur->fwh->devname)))  {
+			ast_cli(fd, "%-15.15s  %-15d %-15d\n", cur->fwh->devname, 
+				ntohs(cur->fwh->version), (int)ntohl(cur->fwh->datalen));
+		}
+	}
 	AST_LIST_UNLOCK(&firmwares);
 
 	return RESULT_SUCCESS;
-#undef FORMAT
-#undef FORMAT2
 }
 
 /* JDG: callback to display iax peers in manager */



More information about the svn-commits mailing list