Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jan 2011 08:00:57 +0000 (UTC)
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r218010 - head/usr.sbin/usbdump
Message-ID:  <201101280800.p0S80vtb064968@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: hselasky
Date: Fri Jan 28 08:00:57 2011
New Revision: 218010
URL: http://svn.freebsd.org/changeset/base/218010

Log:
  - Remove double semicolon.
  - Remove reference to sprintf. Use printf directly. This part of
  the code should be optimised further to avoid many small printouts.
  Setting a sensible line buffer length could help aswell when printing
  out megabytes of data per second.
  
  Approved by:	thompsa (mentor)

Modified:
  head/usr.sbin/usbdump/usbdump.c

Modified: head/usr.sbin/usbdump/usbdump.c
==============================================================================
--- head/usr.sbin/usbdump/usbdump.c	Fri Jan 28 07:04:01 2011	(r218009)
+++ head/usr.sbin/usbdump/usbdump.c	Fri Jan 28 08:00:57 2011	(r218010)
@@ -72,7 +72,7 @@ struct usbcap_filehdr {
 static int doexit = 0;
 static int pkt_captured = 0;
 static int verbose = 0;
-static const char *i_arg = "usbus0";;
+static const char *i_arg = "usbus0";
 static const char *r_arg = NULL;
 static const char *w_arg = NULL;
 static const char *errstr_table[USB_ERR_MAX] = {
@@ -185,11 +185,10 @@ static void
 hexdump(const char *region, size_t len)
 {
 	const char *line;
-	int x, c;
-	char lbuf[80];
-#define EMIT(fmt, args...)	do {		\
-	sprintf(lbuf, fmt , ## args);		\
-	printf("%s", lbuf);			\
+	int x;
+	int c;
+#define EMIT(fmt, ...)	do {		\
+	printf(fmt,## __VA_ARGS__);	\
 } while (0)
 
 	for (line = region; line < (region + len); line += 16) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101280800.p0S80vtb064968>