diff options
| author | Dmitry Antipov | 2012-07-19 07:55:59 +0400 |
|---|---|---|
| committer | Dmitry Antipov | 2012-07-19 07:55:59 +0400 |
| commit | d17337e501a189c1d46f758e10c6c2842cafff17 (patch) | |
| tree | 152a6d615152a9fc12d40e131ebb1886d8972593 /src/buffer.c | |
| parent | 1d29cc7da73dde538c97d029723b8a5a1be6cea1 (diff) | |
| download | emacs-d17337e501a189c1d46f758e10c6c2842cafff17.tar.gz emacs-d17337e501a189c1d46f758e10c6c2842cafff17.zip | |
New macro to iterate over all buffers, miscellaneous cleanups.
* lisp.h (all_buffers): Remove declaration.
* buffer.h (all_buffers): Add declaration, with comment.
(for_each_buffer): New macro.
* alloc.c (Fgarbage_collect, mark_object): Use it.
* buffer.c (Fkill_buffer, Fbuffer_swap_text, Fset_buffer_multibyte)
(init_buffer): Likewise.
* data.c (Fset_default): Likewise.
* coding.c (code_conversion_restore): Remove redundant check
for dead buffer.
* buffer.c (Fkill_buffer): Likewise. Remove obsolete comment.
Diffstat (limited to 'src/buffer.c')
| -rw-r--r-- | src/buffer.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/buffer.c b/src/buffer.c index 1e1bd933f93..40370460b9f 100644 --- a/src/buffer.c +++ b/src/buffer.c | |||
| @@ -1532,10 +1532,8 @@ cleaning up all windows currently displaying the buffer to be killed. */) | |||
| 1532 | 1532 | ||
| 1533 | GCPRO1 (buffer); | 1533 | GCPRO1 (buffer); |
| 1534 | 1534 | ||
| 1535 | for (other = all_buffers; other; other = other->header.next.buffer) | 1535 | for_each_buffer (other) |
| 1536 | /* all_buffers contains dead buffers too; | 1536 | if (other->base_buffer == b) |
| 1537 | don't re-kill them. */ | ||
| 1538 | if (other->base_buffer == b && !NILP (BVAR (other, name))) | ||
| 1539 | { | 1537 | { |
| 1540 | Lisp_Object buf; | 1538 | Lisp_Object buf; |
| 1541 | XSETBUFFER (buf, other); | 1539 | XSETBUFFER (buf, other); |
| @@ -2052,7 +2050,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text, | |||
| 2052 | 2050 | ||
| 2053 | { /* This is probably harder to make work. */ | 2051 | { /* This is probably harder to make work. */ |
| 2054 | struct buffer *other; | 2052 | struct buffer *other; |
| 2055 | for (other = all_buffers; other; other = other->header.next.buffer) | 2053 | for_each_buffer (other) |
| 2056 | if (other->base_buffer == other_buffer | 2054 | if (other->base_buffer == other_buffer |
| 2057 | || other->base_buffer == current_buffer) | 2055 | || other->base_buffer == current_buffer) |
| 2058 | error ("One of the buffers to swap has indirect buffers"); | 2056 | error ("One of the buffers to swap has indirect buffers"); |
| @@ -2429,7 +2427,7 @@ current buffer is cleared. */) | |||
| 2429 | 2427 | ||
| 2430 | /* Copy this buffer's new multibyte status | 2428 | /* Copy this buffer's new multibyte status |
| 2431 | into all of its indirect buffers. */ | 2429 | into all of its indirect buffers. */ |
| 2432 | for (other = all_buffers; other; other = other->header.next.buffer) | 2430 | for_each_buffer (other) |
| 2433 | if (other->base_buffer == current_buffer && !NILP (BVAR (other, name))) | 2431 | if (other->base_buffer == current_buffer && !NILP (BVAR (other, name))) |
| 2434 | { | 2432 | { |
| 2435 | BVAR (other, enable_multibyte_characters) | 2433 | BVAR (other, enable_multibyte_characters) |
| @@ -5035,7 +5033,7 @@ init_buffer (void) | |||
| 5035 | Map new memory. */ | 5033 | Map new memory. */ |
| 5036 | struct buffer *b; | 5034 | struct buffer *b; |
| 5037 | 5035 | ||
| 5038 | for (b = all_buffers; b; b = b->header.next.buffer) | 5036 | for_each_buffer (b) |
| 5039 | if (b->text->beg == NULL) | 5037 | if (b->text->beg == NULL) |
| 5040 | enlarge_buffer_text (b, 0); | 5038 | enlarge_buffer_text (b, 0); |
| 5041 | } | 5039 | } |