This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch v2] ld: optimize vfinfo output slightly


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 == '%')
 	{

Attachment: signature.asc
Description: This is a digitally signed message part.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]