diff options
author | Karl Heuer <kwzh@gnu.org> | 1994-06-07 01:12:36 +0000 |
---|---|---|
committer | Karl Heuer <kwzh@gnu.org> | 1994-06-07 01:12:36 +0000 |
commit | 3ec4ec928dedc2c5fc9e49a0af7717b9c2a5fd57 (patch) | |
tree | c720db1ac07b70f19f2cbab58010e4c7b86428d8 /src/dispnew.c | |
parent | b009e08c8bb9271a20d14d8a79433d354d4db7cb (diff) | |
download | emacs-3ec4ec928dedc2c5fc9e49a0af7717b9c2a5fd57.tar.gz |
(Fframe_or_buffer_changed_p): Reuse the state vector.
Diffstat (limited to 'src/dispnew.c')
-rw-r--r-- | src/dispnew.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/dispnew.c b/src/dispnew.c index 29b2777fd20..81470fba4ad 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -1858,7 +1858,7 @@ update_line (frame, vpos) current_frame->charstarts[vpos] = temp1; } -/* A vector of size NFRAMES + 3 * NBUFFERS + 1, containing the session's +/* A vector of size >= NFRAMES + 3 * NBUFFERS + 1, containing the session's frames, buffers, buffer-read-only flags, and buffer-modified-flags, and a trailing sentinel (so we don't need to add length checks). */ static Lisp_Object frame_and_buffer_state; @@ -1897,7 +1897,10 @@ the current state.\n") n++; for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr) n += 3; - frame_and_buffer_state = Fmake_vector (make_number (n), Qlambda); + /* Reallocate the vector if it's grown, or if it's shrunk a lot. */ + if (n > XVECTOR (frame_and_buffer_state)->size + || n < XVECTOR (frame_and_buffer_state)->size / 2) + frame_and_buffer_state = Fmake_vector (make_number (n), Qlambda); vecp = XVECTOR (frame_and_buffer_state)->contents; FOR_EACH_FRAME (tail, frame) *vecp++ = frame; @@ -1908,6 +1911,9 @@ the current state.\n") *vecp++ = XBUFFER (buf)->read_only; *vecp++ = Fbuffer_modified_p (buf); } + /* If we left any slack in the vector, fill it up now. */ + for (; n < XVECTOR (frame_and_buffer_state)->size; ++n) + *vecp++ = Qlambda; return Qt; } |