aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc.c
diff options
context:
space:
mode:
authorDmitry Antipov2012-08-08 16:12:40 +0400
committerDmitry Antipov2012-08-08 16:12:40 +0400
commit8707c1e56ca83a0a34785e451dcef428c60242fe (patch)
treef404532e675b2870620faafa8d94dacf618c1a22 /src/alloc.c
parentad8c997f72c95b7351eab4c8ea2ac8c667545e6f (diff)
downloademacs-8707c1e56ca83a0a34785e451dcef428c60242fe.tar.gz
emacs-8707c1e56ca83a0a34785e451dcef428c60242fe.zip
Inline functions to examine and change buffer intervals.
* alloc.c (mark_interval_tree): Remove. (MARK_INTERVAL_TREE): Simplify. (UNMARK_BALANCE_INTERVALS): Remove. Adjust users. * intervals.c (buffer_balance_intervals): New function. (graft_intervals_into_buffer): Adjust indentation. (set_intervals_multibyte): Simplify. * buffer.h (BUF_INTERVALS): Remove. (buffer_get_intervals, buffer_set_intervals): New function. * alloc.c, buffer.c, editfns.c, fileio.c, indent.c, insdel.c: * intervals.c, textprop.c: Adjust users.
Diffstat (limited to 'src/alloc.c')
-rw-r--r--src/alloc.c40
1 files changed, 9 insertions, 31 deletions
diff --git a/src/alloc.c b/src/alloc.c
index 95309f076d4..c93fcb564c7 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -1542,35 +1542,12 @@ mark_interval (register INTERVAL i, Lisp_Object dummy)
1542 mark_object (i->plist); 1542 mark_object (i->plist);
1543} 1543}
1544 1544
1545
1546/* Mark the interval tree rooted in TREE. Don't call this directly;
1547 use the macro MARK_INTERVAL_TREE instead. */
1548
1549static void
1550mark_interval_tree (register INTERVAL tree)
1551{
1552 /* No need to test if this tree has been marked already; this
1553 function is always called through the MARK_INTERVAL_TREE macro,
1554 which takes care of that. */
1555
1556 traverse_intervals_noorder (tree, mark_interval, Qnil);
1557}
1558
1559
1560/* Mark the interval tree rooted in I. */ 1545/* Mark the interval tree rooted in I. */
1561 1546
1562#define MARK_INTERVAL_TREE(i) \ 1547#define MARK_INTERVAL_TREE(i) \
1563 do { \ 1548 do { \
1564 if (i && !i->gcmarkbit) \ 1549 if (i && !i->gcmarkbit) \
1565 mark_interval_tree (i); \ 1550 traverse_intervals_noorder (i, mark_interval, Qnil); \
1566 } while (0)
1567
1568/* Unmark and rebalance interval tree rooted in I. */
1569
1570#define UNMARK_BALANCE_INTERVALS(i) \
1571 do { \
1572 if (i) \
1573 (i) = balance_intervals (i); \
1574 } while (0) 1551 } while (0)
1575 1552
1576/*********************************************************************** 1553/***********************************************************************
@@ -2101,8 +2078,8 @@ sweep_strings (void)
2101 /* String is live; unmark it and its intervals. */ 2078 /* String is live; unmark it and its intervals. */
2102 UNMARK_STRING (s); 2079 UNMARK_STRING (s);
2103 2080
2104 if (s->intervals) 2081 /* Do not use string_(set|get)_intervals here. */
2105 UNMARK_BALANCE_INTERVALS (s->intervals); 2082 s->intervals = balance_intervals (s->intervals);
2106 2083
2107 ++total_strings; 2084 ++total_strings;
2108 total_string_bytes += STRING_BYTES (s); 2085 total_string_bytes += STRING_BYTES (s);
@@ -5848,7 +5825,7 @@ mark_buffer (struct buffer *buffer)
5848 5825
5849 /* ...but there are some buffer-specific things. */ 5826 /* ...but there are some buffer-specific things. */
5850 5827
5851 MARK_INTERVAL_TREE (BUF_INTERVALS (buffer)); 5828 MARK_INTERVAL_TREE (buffer_get_intervals (buffer));
5852 5829
5853 /* For now, we just don't mark the undo_list. It's done later in 5830 /* For now, we just don't mark the undo_list. It's done later in
5854 a special way just before the sweep phase, and after stripping 5831 a special way just before the sweep phase, and after stripping
@@ -6587,7 +6564,8 @@ gc_sweep (void)
6587 else 6564 else
6588 { 6565 {
6589 VECTOR_UNMARK (buffer); 6566 VECTOR_UNMARK (buffer);
6590 UNMARK_BALANCE_INTERVALS (BUF_INTERVALS (buffer)); 6567 /* Do not use buffer_(set|get)_intervals here. */
6568 buffer->text->intervals = balance_intervals (buffer->text->intervals);
6591 total_buffers++; 6569 total_buffers++;
6592 prev = buffer, buffer = buffer->header.next.buffer; 6570 prev = buffer, buffer = buffer->header.next.buffer;
6593 } 6571 }