svn commit: trunk/busybox/coreutils

aldot at busybox.net aldot at busybox.net
Wed Jan 17 19:46:33 UTC 2007


Author: aldot
Date: 2007-01-17 11:46:33 -0800 (Wed, 17 Jan 2007)
New Revision: 17354

Log:
- reuse return code of vsnprintf to avoid pulling in strlen


Modified:
   trunk/busybox/coreutils/stty.c


Changeset:
Modified: trunk/busybox/coreutils/stty.c
===================================================================
--- trunk/busybox/coreutils/stty.c	2007-01-17 19:46:12 UTC (rev 17353)
+++ trunk/busybox/coreutils/stty.c	2007-01-17 19:46:33 UTC (rev 17354)
@@ -463,10 +463,10 @@
 	int buflen;
 
 	va_start(args, message);
-	vsnprintf(buf, sizeof(buf), message, args);
+	buflen = vsnprintf(buf, sizeof(buf), message, args);
 	va_end(args);
-	buflen = strlen(buf);
-	if (!buflen) return;
+	/* buflen = strlen(buf); cheaper not to pull in strlen */
+	if (!buflen /*|| buflen >= sizeof(buf)*/) return;
 
 	if (current_col > 0) {
 		current_col++;




More information about the busybox-cvs mailing list