[patch v2] ld: optimize vfinfo output slightly

Mike Frysinger vapier@gentoo.org
Sat Mar 31 15:11:00 GMT 2012


2012-03-24  Mike Frysinger  <vapier@gentoo.org>

	* ldmisc.c (vfinfo): Assign new local str to fmt.  Delete
	putc call.  If str and fmt are different, call fwrite on
	the difference.

--- ldmisc.c	18 Feb 2012 11:55:45 -0000	1.42
+++ ldmisc.c	31 Mar 2012 15:10:07 -0000
@@ -72,11 +72,14 @@ vfinfo (FILE *fp, const char *fmt, va_li
 
   while (*fmt != '\0')
     {
+      const char *str = fmt;
       while (*fmt != '%' && *fmt != '\0')
-	{
-	  putc (*fmt, fp);
-	  fmt++;
-	}
+	fmt++;
+      if (fmt != str)
+	if (fwrite (str, 1, fmt - str, fp))
+	  {
+	    /* Ignore.  */
+	  }
 
       if (*fmt == '%')
 	{
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/binutils/attachments/20120331/f099daa3/attachment.sig>


More information about the Binutils mailing list