diagnostic.c (v_message_with_decl): Use .* format specifier instead of building the...
authorKaveh R. Ghazi <ghazi@caip.rutgers.edu>
Mon, 27 Dec 1999 16:52:03 +0000 (16:52 +0000)
committerKaveh Ghazi <ghazi@gcc.gnu.org>
Mon, 27 Dec 1999 16:52:03 +0000 (16:52 +0000)
       * diagnostic.c (v_message_with_decl): Use .* format specifier
       instead of building the format specifier width manually.

From-SVN: r31101

gcc/ChangeLog
gcc/diagnostic.c

index 35ee30d603d0c05ff9c0eac8a9f4b58972ec93ec..676a52558fed2167706290235d8266d922fbd672 100644 (file)
@@ -1,5 +1,8 @@
 1999-12-27  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
+       * diagnostic.c (v_message_with_decl): Use .* format specifier
+       instead of building the format specifier width manually.
+
        * system.h (strsignal): Don't check HAVE_STRSIGNAL when
        determining whether to provide a prototype.  Remove the
        sys_siglist clause in the conditional.
index 857291328969f8cb51f60db25898add4dc3063b1..1365e714d1929bbf124957cee4862ba480c16f3c 100644 (file)
@@ -198,14 +198,7 @@ v_message_with_decl (decl, warn, msgid, ap)
     }
 
   if (p > _(msgid))                    /* Print the left-hand substring.  */
-    {
-      char fmt[sizeof "%.255s"];
-      long width = p - _(msgid);
-             
-      if (width > 255L) width = 255L;  /* arbitrary */
-      sprintf (fmt, "%%.%lds", width);
-      fprintf (stderr, fmt, _(msgid));
-    }
+    fprintf (stderr, "%.*s", (int)(p - _(msgid)), _(msgid));
 
   if (*p == '%')               /* Print the name.  */
     {