aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGerd Moellmann2000-12-08 09:59:34 +0000
committerGerd Moellmann2000-12-08 09:59:34 +0000
commit5d65df0d39324a62140d37219f67dcdb42aafe99 (patch)
tree103341d683c05350126dc7c25ce6267cd340f433 /src
parent23751e2577de307f57fc64734324db219f98c45d (diff)
downloademacs-5d65df0d39324a62140d37219f67dcdb42aafe99.tar.gz
emacs-5d65df0d39324a62140d37219f67dcdb42aafe99.zip
(read1): Change the way buffers are reallocated to be
portable and less obfuscated.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/src/lread.c b/src/lread.c
index 55663e09b25..815612da3a4 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -1,5 +1,5 @@
1/* Lisp parsing and input streams. 1/* Lisp parsing and input streams.
2 Copyright (C) 1985, 86, 87, 88, 89, 93, 94, 95, 97, 98, 1999 2 Copyright (C) 1985, 86, 87, 88, 89, 93, 94, 95, 97, 98, 99, 2000
3 Free Software Foundation, Inc. 3 Free Software Foundation, Inc.
4 4
5This file is part of GNU Emacs. 5This file is part of GNU Emacs.
@@ -2120,9 +2120,10 @@ read1 (readcharfun, pch, first_in_list)
2120 { 2120 {
2121 if (end - p < MAX_MULTIBYTE_LENGTH) 2121 if (end - p < MAX_MULTIBYTE_LENGTH)
2122 { 2122 {
2123 char *new = (char *) xrealloc (read_buffer, read_buffer_size *= 2); 2123 int offset = p - read_buffer;
2124 p += new - read_buffer; 2124 read_buffer = (char *) xrealloc (read_buffer,
2125 read_buffer += new - read_buffer; 2125 read_buffer_size *= 2);
2126 p = read_buffer + offset;
2126 end = read_buffer + read_buffer_size; 2127 end = read_buffer + read_buffer_size;
2127 } 2128 }
2128 2129
@@ -2260,10 +2261,10 @@ read1 (readcharfun, pch, first_in_list)
2260 { 2261 {
2261 if (end - p < MAX_MULTIBYTE_LENGTH) 2262 if (end - p < MAX_MULTIBYTE_LENGTH)
2262 { 2263 {
2263 char *new = (char *) xrealloc (read_buffer, 2264 int offset = p - read_buffer;
2264 read_buffer_size *= 2); 2265 read_buffer = (char *) xrealloc (read_buffer,
2265 p += new - read_buffer; 2266 read_buffer_size *= 2);
2266 read_buffer += new - read_buffer; 2267 p = read_buffer + offset;
2267 end = read_buffer + read_buffer_size; 2268 end = read_buffer + read_buffer_size;
2268 } 2269 }
2269 2270
@@ -2283,10 +2284,11 @@ read1 (readcharfun, pch, first_in_list)
2283 2284
2284 if (p == end) 2285 if (p == end)
2285 { 2286 {
2286 char *new = (char *) xrealloc (read_buffer, read_buffer_size *= 2); 2287 int offset = p - read_buffer;
2287 p += new - read_buffer; 2288 read_buffer = (char *) xrealloc (read_buffer,
2288 read_buffer += new - read_buffer; 2289 read_buffer_size *= 2);
2289/* end = read_buffer + read_buffer_size; */ 2290 p = read_buffer + offset;
2291 end = read_buffer + read_buffer_size;
2290 } 2292 }
2291 *p = 0; 2293 *p = 0;
2292 if (c >= 0) 2294 if (c >= 0)