summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorDmitry Antipov <dmantipov@yandex.ru>2012-07-19 07:55:59 +0400
committerDmitry Antipov <dmantipov@yandex.ru>2012-07-19 07:55:59 +0400
commitd17337e501a189c1d46f758e10c6c2842cafff17 (patch)
tree152a6d615152a9fc12d40e131ebb1886d8972593 /src/buffer.c
parent1d29cc7da73dde538c97d029723b8a5a1be6cea1 (diff)
downloademacs-d17337e501a189c1d46f758e10c6c2842cafff17.tar.gz
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.c12
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. */)
GCPRO1 (buffer);
- for (other = all_buffers; other; other = other->header.next.buffer)
- /* all_buffers contains dead buffers too;
- don't re-kill them. */
- if (other->base_buffer == b && !NILP (BVAR (other, name)))
+ for_each_buffer (other)
+ if (other->base_buffer == b)
{
Lisp_Object buf;
XSETBUFFER (buf, other);
@@ -2052,7 +2050,7 @@ DEFUN ("buffer-swap-text", Fbuffer_swap_text, Sbuffer_swap_text,
{ /* This is probably harder to make work. */
struct buffer *other;
- for (other = all_buffers; other; other = other->header.next.buffer)
+ for_each_buffer (other)
if (other->base_buffer == other_buffer
|| other->base_buffer == current_buffer)
error ("One of the buffers to swap has indirect buffers");
@@ -2429,7 +2427,7 @@ current buffer is cleared. */)
/* Copy this buffer's new multibyte status
into all of its indirect buffers. */
- for (other = all_buffers; other; other = other->header.next.buffer)
+ for_each_buffer (other)
if (other->base_buffer == current_buffer && !NILP (BVAR (other, name)))
{
BVAR (other, enable_multibyte_characters)
@@ -5035,7 +5033,7 @@ init_buffer (void)
Map new memory. */
struct buffer *b;
- for (b = all_buffers; b; b = b->header.next.buffer)
+ for_each_buffer (b)
if (b->text->beg == NULL)
enlarge_buffer_text (b, 0);
}