comparison src/alloc.c @ 21306:dc2cbd40703c

(mark_buffer): Mark the undo_list slot specially; don't mark a marker just cause it is in this list. (Fgarbage_collect): Discard from all undo-lists all elements that adjust markers that were not marked.
author Richard M. Stallman <rms@gnu.org>
date Sat, 28 Mar 1998 21:50:59 +0000
parents 693573ac0944
children 1701bf5b9dec
comparison
equal deleted inserted replaced
21305:c26bceb68019 21306:dc2cbd40703c
1813 mark_object (&backlist->args[i]); 1813 mark_object (&backlist->args[i]);
1814 XMARK (backlist->args[i]); 1814 XMARK (backlist->args[i]);
1815 } 1815 }
1816 } 1816 }
1817 mark_kboards (); 1817 mark_kboards ();
1818
1819 /* Look thru every buffer's undo list
1820 for elements that update markers that were not marked,
1821 and delete them. */
1822 {
1823 register struct buffer *nextb = all_buffers;
1824
1825 while (nextb)
1826 {
1827 /* If a buffer's undo list is Qt, that means that undo is
1828 turned off in that buffer. Calling truncate_undo_list on
1829 Qt tends to return NULL, which effectively turns undo back on.
1830 So don't call truncate_undo_list if undo_list is Qt. */
1831 if (! EQ (nextb->undo_list, Qt))
1832 {
1833 Lisp_Object tail, prev;
1834 tail = nextb->undo_list;
1835 prev = Qnil;
1836 while (CONSP (tail))
1837 {
1838 if (GC_CONSP (XCONS (tail)->car)
1839 && GC_MARKERP (XCONS (XCONS (tail)->car)->car)
1840 && ! XMARKBIT (XMARKER (XCONS (XCONS (tail)->car)->car)->chain))
1841 {
1842 if (NILP (prev))
1843 nextb->undo_list = tail = XCONS (tail)->cdr;
1844 else
1845 tail = XCONS (prev)->cdr = XCONS (tail)->cdr;
1846 }
1847 else
1848 {
1849 prev = tail;
1850 tail = XCONS (tail)->cdr;
1851 }
1852 }
1853 }
1854
1855 nextb = nextb->next;
1856 }
1857 }
1818 1858
1819 gc_sweep (); 1859 gc_sweep ();
1820 1860
1821 /* Clear the mark bits that we set in certain root slots. */ 1861 /* Clear the mark bits that we set in certain root slots. */
1822 1862
2225 /* This is the buffer's markbit */ 2265 /* This is the buffer's markbit */
2226 mark_object (&buffer->name); 2266 mark_object (&buffer->name);
2227 XMARK (buffer->name); 2267 XMARK (buffer->name);
2228 2268
2229 MARK_INTERVAL_TREE (BUF_INTERVALS (buffer)); 2269 MARK_INTERVAL_TREE (BUF_INTERVALS (buffer));
2270
2271 if (CONSP (buffer->undo_list))
2272 {
2273 Lisp_Object tail;
2274 tail = buffer->undo_list;
2275
2276 while (CONSP (tail))
2277 {
2278 register struct Lisp_Cons *ptr = XCONS (tail);
2279
2280 if (XMARKBIT (ptr->car))
2281 break;
2282 XMARK (ptr->car);
2283 if (GC_CONSP (ptr->car)
2284 && ! XMARKBIT (XCONS (ptr->car)->car)
2285 && GC_MARKERP (XCONS (ptr->car)->car))
2286 {
2287 XMARK (XCONS (ptr->car)->car);
2288 mark_object (&XCONS (ptr->car)->cdr);
2289 }
2290 else
2291 mark_object (&ptr->car);
2292
2293 if (CONSP (ptr->cdr))
2294 tail = ptr->cdr;
2295 else
2296 break;
2297 }
2298
2299 mark_object (&XCONS (tail)->cdr);
2300 }
2301 else
2302 mark_object (&buffer->undo_list);
2230 2303
2231 #if 0 2304 #if 0
2232 mark_object (buffer->syntax_table); 2305 mark_object (buffer->syntax_table);
2233 2306
2234 /* Mark the various string-pointers in the buffer object. 2307 /* Mark the various string-pointers in the buffer object.