(to_multibyte): Fix computation of new read_buffer_size.
authorGerd Moellmann <gerd@gnu.org>
Wed, 31 Oct 2001 13:33:56 +0000 (13:33 +0000)
committerGerd Moellmann <gerd@gnu.org>
Wed, 31 Oct 2001 13:33:56 +0000 (13:33 +0000)
src/ChangeLog
src/lread.c

index ba97028..fb2b720 100644 (file)
@@ -1,5 +1,7 @@
 2001-10-31  Gerd Moellmann  <gerd@gnu.org>
 
+       * lread.c (to_multibyte): Fix computation of new read_buffer_size.
+
        * xfaces.c (realize_x_face): If C is not a single-byte character,
        set the face's colors_copied_bitwise_p instead of the defaulted_p
        members which have a different meaning.
index 93fe9a9..be0ecb6 100644 (file)
@@ -1793,7 +1793,7 @@ to_multibyte (p, end, nchars)
   if (read_buffer_size < 2 * nbytes)
     {
       int offset = *p - read_buffer;
-      read_buffer_size *= 2;
+      read_buffer_size = 2 * max (read_buffer_size, nbytes);
       read_buffer = (char *) xrealloc (read_buffer, read_buffer_size);
       *p = read_buffer + offset;
       *end = read_buffer + read_buffer_size;