diff options
| author | Dmitry Antipov | 2012-10-17 08:58:15 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-10-17 08:58:15 +0400 |
| commit | f0863a54681cfe7d40a0844bd2ce812eed408002 (patch) | |
| tree | 5f6db03327a067c8d3348518a33c793430d3afc7 /src | |
| parent | ab1dc14b220747e527d507d40905a24ba5c692d9 (diff) | |
| download | emacs-f0863a54681cfe7d40a0844bd2ce812eed408002.tar.gz emacs-f0863a54681cfe7d40a0844bd2ce812eed408002.zip | |
Do not verify indirection counters of killed buffers (Bug#12579).
* buffer.h (BUFFER_CHECK_INDIRECTION): New macro.
* buffer.c (compact_buffer, set_buffer_internal_1): Use it.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 6 | ||||
| -rw-r--r-- | src/buffer.c | 13 | ||||
| -rw-r--r-- | src/buffer.h | 16 |
3 files changed, 26 insertions, 9 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 3c62dffc3e0..bea7c9331db 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2012-10-17 Dmitry Antipov <dmantipov@yandex.ru> | ||
| 2 | |||
| 3 | Do not verify indirection counters of killed buffers (Bug#12579). | ||
| 4 | * buffer.h (BUFFER_CHECK_INDIRECTION): New macro. | ||
| 5 | * buffer.c (compact_buffer, set_buffer_internal_1): Use it. | ||
| 6 | |||
| 1 | 2012-10-16 Dmitry Antipov <dmantipov@yandex.ru> | 7 | 2012-10-16 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 8 | ||
| 3 | * alloc.c (Fmake_byte_code): Fix typo in comment. | 9 | * alloc.c (Fmake_byte_code): Fix typo in comment. |
diff --git a/src/buffer.c b/src/buffer.c index 861a89b5a0f..8e77db66d43 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1663,18 +1663,11 @@ No argument or nil as argument means do this for the current buffer. */) | |||
| 1663 | void | 1663 | void |
| 1664 | compact_buffer (struct buffer *buffer) | 1664 | compact_buffer (struct buffer *buffer) |
| 1665 | { | 1665 | { |
| 1666 | /* Verify indirection counters. */ | 1666 | BUFFER_CHECK_INDIRECTION (buffer); |
| 1667 | if (buffer->base_buffer) | ||
| 1668 | { | ||
| 1669 | eassert (buffer->indirections == -1); | ||
| 1670 | eassert (buffer->base_buffer->indirections > 0); | ||
| 1671 | } | ||
| 1672 | else | ||
| 1673 | eassert (buffer->indirections >= 0); | ||
| 1674 | 1667 | ||
| 1675 | /* Skip dead buffers, indirect buffers and buffers | 1668 | /* Skip dead buffers, indirect buffers and buffers |
| 1676 | which aren't changed since last compaction. */ | 1669 | which aren't changed since last compaction. */ |
| 1677 | if (!NILP (buffer->INTERNAL_FIELD (name)) | 1670 | if (BUFFER_LIVE_P (buffer) |
| 1678 | && (buffer->base_buffer == NULL) | 1671 | && (buffer->base_buffer == NULL) |
| 1679 | && (buffer->text->compact != buffer->text->modiff)) | 1672 | && (buffer->text->compact != buffer->text->modiff)) |
| 1680 | { | 1673 | { |
| @@ -2114,6 +2107,8 @@ set_buffer_internal_1 (register struct buffer *b) | |||
| 2114 | if (current_buffer == b) | 2107 | if (current_buffer == b) |
| 2115 | return; | 2108 | return; |
| 2116 | 2109 | ||
| 2110 | BUFFER_CHECK_INDIRECTION (b); | ||
| 2111 | |||
| 2117 | old_buf = current_buffer; | 2112 | old_buf = current_buffer; |
| 2118 | current_buffer = b; | 2113 | current_buffer = b; |
| 2119 | last_known_column_point = -1; /* invalidate indentation cache */ | 2114 | last_known_column_point = -1; /* invalidate indentation cache */ |
diff --git a/src/buffer.h b/src/buffer.h index d18ef30ea38..9e0e9eef0b1 100644 --- a/src/buffer.h +++ b/src/buffer.h | |||
| @@ -963,6 +963,22 @@ bset_width_table (struct buffer *b, Lisp_Object val) | |||
| 963 | 963 | ||
| 964 | #define BUFFER_LIVE_P(b) (!NILP (BVAR (b, name))) | 964 | #define BUFFER_LIVE_P(b) (!NILP (BVAR (b, name))) |
| 965 | 965 | ||
| 966 | /* Verify indirection counters. */ | ||
| 967 | |||
| 968 | #define BUFFER_CHECK_INDIRECTION(b) \ | ||
| 969 | do { \ | ||
| 970 | if (BUFFER_LIVE_P (b)) \ | ||
| 971 | { \ | ||
| 972 | if (b->base_buffer) \ | ||
| 973 | { \ | ||
| 974 | eassert (b->indirections == -1); \ | ||
| 975 | eassert (b->base_buffer->indirections > 0); \ | ||
| 976 | } \ | ||
| 977 | else \ | ||
| 978 | eassert (b->indirections >= 0); \ | ||
| 979 | } \ | ||
| 980 | } while (0) | ||
| 981 | |||
| 966 | /* Chain of all buffers, including killed ones. */ | 982 | /* Chain of all buffers, including killed ones. */ |
| 967 | 983 | ||
| 968 | extern struct buffer *all_buffers; | 984 | extern struct buffer *all_buffers; |