Mercurial > emacs
comparison src/dispnew.c @ 7814:e1e536773850
(Fframe_or_buffer_changed_p): Reuse the state vector.
author | Karl Heuer <kwzh@gnu.org> |
---|---|
date | Tue, 07 Jun 1994 01:12:36 +0000 |
parents | 15c0bf73737e |
children | 60795e826dad |
comparison
equal
deleted
inserted
replaced
7813:1fa576a274b5 | 7814:e1e536773850 |
---|---|
1856 temp1 = desired_frame->charstarts[vpos]; | 1856 temp1 = desired_frame->charstarts[vpos]; |
1857 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos]; | 1857 desired_frame->charstarts[vpos] = current_frame->charstarts[vpos]; |
1858 current_frame->charstarts[vpos] = temp1; | 1858 current_frame->charstarts[vpos] = temp1; |
1859 } | 1859 } |
1860 | 1860 |
1861 /* A vector of size NFRAMES + 3 * NBUFFERS + 1, containing the session's | 1861 /* A vector of size >= NFRAMES + 3 * NBUFFERS + 1, containing the session's |
1862 frames, buffers, buffer-read-only flags, and buffer-modified-flags, | 1862 frames, buffers, buffer-read-only flags, and buffer-modified-flags, |
1863 and a trailing sentinel (so we don't need to add length checks). */ | 1863 and a trailing sentinel (so we don't need to add length checks). */ |
1864 static Lisp_Object frame_and_buffer_state; | 1864 static Lisp_Object frame_and_buffer_state; |
1865 | 1865 |
1866 DEFUN ("frame-or-buffer-changed-p", Fframe_or_buffer_changed_p, | 1866 DEFUN ("frame-or-buffer-changed-p", Fframe_or_buffer_changed_p, |
1895 n = 1; | 1895 n = 1; |
1896 FOR_EACH_FRAME (tail, frame) | 1896 FOR_EACH_FRAME (tail, frame) |
1897 n++; | 1897 n++; |
1898 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr) | 1898 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr) |
1899 n += 3; | 1899 n += 3; |
1900 frame_and_buffer_state = Fmake_vector (make_number (n), Qlambda); | 1900 /* Reallocate the vector if it's grown, or if it's shrunk a lot. */ |
1901 if (n > XVECTOR (frame_and_buffer_state)->size | |
1902 || n < XVECTOR (frame_and_buffer_state)->size / 2) | |
1903 frame_and_buffer_state = Fmake_vector (make_number (n), Qlambda); | |
1901 vecp = XVECTOR (frame_and_buffer_state)->contents; | 1904 vecp = XVECTOR (frame_and_buffer_state)->contents; |
1902 FOR_EACH_FRAME (tail, frame) | 1905 FOR_EACH_FRAME (tail, frame) |
1903 *vecp++ = frame; | 1906 *vecp++ = frame; |
1904 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr) | 1907 for (tail = Vbuffer_alist; CONSP (tail); tail = XCONS (tail)->cdr) |
1905 { | 1908 { |
1906 buf = XCONS (XCONS (tail)->car)->cdr; | 1909 buf = XCONS (XCONS (tail)->car)->cdr; |
1907 *vecp++ = buf; | 1910 *vecp++ = buf; |
1908 *vecp++ = XBUFFER (buf)->read_only; | 1911 *vecp++ = XBUFFER (buf)->read_only; |
1909 *vecp++ = Fbuffer_modified_p (buf); | 1912 *vecp++ = Fbuffer_modified_p (buf); |
1910 } | 1913 } |
1914 /* If we left any slack in the vector, fill it up now. */ | |
1915 for (; n < XVECTOR (frame_and_buffer_state)->size; ++n) | |
1916 *vecp++ = Qlambda; | |
1911 return Qt; | 1917 return Qt; |
1912 } | 1918 } |
1913 | 1919 |
1914 DEFUN ("open-termscript", Fopen_termscript, Sopen_termscript, | 1920 DEFUN ("open-termscript", Fopen_termscript, Sopen_termscript, |
1915 1, 1, "FOpen termscript file: ", | 1921 1, 1, "FOpen termscript file: ", |