Source-Changes-HG archive

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

[src/netbsd-1-4]: src/gnu/usr.bin/gas Pull up revision 1.7 (requested by mycr...



details:   https://anonhg.NetBSD.org/src/rev/f54cf8658612
branches:  netbsd-1-4
changeset: 470205:f54cf8658612
user:      he <he%NetBSD.org@localhost>
date:      Mon Jan 31 18:43:20 2000 +0000

description:
Pull up revision 1.7 (requested by mycroft):
  Handle arbitrarily long input lines.

diffstat:

 gnu/usr.bin/gas/input-scrub.c |  37 ++++++++++++++++++++++++++++++++-----
 1 files changed, 32 insertions(+), 5 deletions(-)

diffs (61 lines):

diff -r 0abe9f49befc -r f54cf8658612 gnu/usr.bin/gas/input-scrub.c
--- a/gnu/usr.bin/gas/input-scrub.c     Mon Jan 24 10:49:19 2000 +0000
+++ b/gnu/usr.bin/gas/input-scrub.c     Mon Jan 31 18:43:20 2000 +0000
@@ -18,7 +18,7 @@
    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
 
 #ifndef lint
-static char rcsid[] = "$Id: input-scrub.c,v 1.6 1994/08/25 07:36:22 pk Exp $";
+static char rcsid[] = "$Id: input-scrub.c,v 1.6.8.1 2000/01/31 18:43:20 he Exp $";
 #endif
 
 #include <errno.h>             /* Need this to make errno declaration right */
@@ -258,17 +258,44 @@
              (unsigned int) partial_size);
       memcpy (buffer_start + BEFORE_SIZE, save_source, AFTER_SIZE);
     }
-  limit = input_file_give_next_buffer (buffer_start + BEFORE_SIZE + partial_size);
+  limit = input_file_give_next_buffer (buffer_start
+                                      + BEFORE_SIZE
+                                      + partial_size);
   if (limit)
     {
       register char *p;                /* Find last newline. */
 
-      for (p = limit; *--p != '\n';);;
+      for (p = limit - 1; *p != '\n'; --p)
+       ;
       ++p;
-      if (p <= buffer_start + BEFORE_SIZE)
+
+      while (p <= buffer_start + BEFORE_SIZE)
        {
-         as_fatal ("Source line too long. Please change file %s then rebuild assembler.", __FILE__);
+         int limoff;
+
+         limoff = limit - buffer_start;
+         buffer_length += input_file_buffer_size ();
+         buffer_start = xrealloc (buffer_start,
+                                  (BEFORE_SIZE
+                                   + 2 * buffer_length
+                                   + AFTER_SIZE));
+         *bufp = buffer_start + BEFORE_SIZE;
+         limit = input_file_give_next_buffer (buffer_start + limoff);
+
+         if (limit == NULL)
+           {
+             as_warn ("partial line at end of file ignored");
+             partial_where = NULL;
+             if (next_saved_file)
+               *bufp = input_scrub_pop (next_saved_file);
+             return NULL;
+           }
+
+         for (p = limit - 1; *p != '\n'; --p)
+           ;
+         ++p;
        }
+
       partial_where = p;
       partial_size = limit - p;
       memcpy (save_source, partial_where, (int) AFTER_SIZE);



Home | Main Index | Thread Index | Old Index