m4-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Changes to m4/m4/output.c,v


From: Eric Blake
Subject: Changes to m4/m4/output.c,v
Date: Tue, 23 Oct 2007 14:17:56 +0000

CVSROOT:        /sources/m4
Module name:    m4
Changes by:     Eric Blake <ericb>      07/10/23 14:17:55

Index: m4/output.c
===================================================================
RCS file: /sources/m4/m4/m4/output.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -u -b -r1.48 -r1.49
--- m4/output.c 7 Aug 2007 03:15:27 -0000       1.48
+++ m4/output.c 23 Oct 2007 14:17:54 -0000      1.49
@@ -24,8 +24,9 @@
 
 #include "binary-io.h"
 #include "clean-temp.h"
-#include "gl_avltree_oset.h"
 #include "exitfail.h"
+#include "gl_avltree_oset.h"
+#include "intprops.h"
 #include "xvasprintf.h"
 
 /* Define this to see runtime debug output.  Implied by DEBUG.  */
@@ -465,7 +466,7 @@
                 const char *text, size_t length, int line)
 {
   static bool start_of_output_line = true;
-  char linebuf[20];
+  char linebuf[6 + INT_BUFSIZE_BOUND (unsigned long int)]; /* "#line nnnn" */
   const char *cursor;
 
   /* If output goes to an obstack, merely add TEXT to it.  */
@@ -517,7 +518,7 @@
          m4_set_output_line (context, m4_get_output_line (context) + 1);
 
 #ifdef DEBUG_OUTPUT
-         fprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
+         xfprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
                   (unsigned long int) m4_get_current_line (context),
                   (unsigned long int) m4_get_output_line (context));
 #endif
@@ -558,7 +559,7 @@
              m4_set_output_line (context, m4_get_output_line (context) + 1);
 
 #ifdef DEBUG_OUTPUT
-             fprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
+             xfprintf (stderr, "DEBUG: line %d, cur %lu, cur out %lu\n", line,
                       (unsigned long int) m4_get_current_line (context),
                       (unsigned long int) m4_get_output_line (context));
 #endif
@@ -576,7 +577,7 @@
 void
 m4_shipout_int (m4_obstack *obs, int val)
 {
-  char buf[128];
+  char buf[INT_BUFSIZE_BOUND (int)];
 
   sprintf(buf, "%d", val);
   obstack_grow (obs, buf, strlen (buf));
@@ -845,7 +846,7 @@
          if (diversion->size)
            {
              assert (diversion->used == (int) diversion->used);
-             fprintf (file, "D%d,%d\n", diversion->divnum,
+             xfprintf (file, "D%d,%d\n", diversion->divnum,
                       (int) diversion->used);
            }
          else
@@ -863,7 +864,7 @@
                  || file_stat.st_size != (unsigned long int) file_stat.st_size)
                m4_error (context, EXIT_FAILURE, errno,
                          _("diversion too large"));
-             fprintf (file, "D%d,%lu\n", diversion->divnum,
+             xfprintf (file, "D%d,%lu\n", diversion->divnum,
                       (unsigned long int) file_stat.st_size);
            }
 
@@ -878,5 +879,5 @@
   /* Save the active diversion number, if not already.  */
 
   if (saved_number != last_inserted)
-    fprintf (file, "D%d,0\n\n", saved_number);
+    xfprintf (file, "D%d,0\n\n", saved_number);
 }




reply via email to

[Prev in Thread] Current Thread [Next in Thread]