diff options
author | Dmitry Antipov <dmantipov@yandex.ru> | 2012-12-24 15:41:28 +0400 |
---|---|---|
committer | Dmitry Antipov <dmantipov@yandex.ru> | 2012-12-24 15:41:28 +0400 |
commit | f9e7c67e4ccdaf160c0506748f776d628a38eeba (patch) | |
tree | 5450281668646d918080a93c474bc461c84c9b84 /src | |
parent | dab2e22def49ff65ec803c070df4984424808aed (diff) | |
download | emacs-f9e7c67e4ccdaf160c0506748f776d628a38eeba.tar.gz |
* buffer.h (BUF_COMPACT): New macro to follow the common style.
* buffer.c (Fget_buffer_create): Use it to set compact field of
struct buffer_text to avoid accessing an uninitialized value
when compact_buffer is called for the first time.
(compact_buffer): Use convenient BUF_COMPACT and BUF_MODIFF.
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 8 | ||||
-rw-r--r-- | src/buffer.c | 5 | ||||
-rw-r--r-- | src/buffer.h | 3 |
3 files changed, 14 insertions, 2 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 648f14a61e4..1967cdb8557 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2012-12-24 Dmitry Antipov <dmantipov@yandex.ru> + + * buffer.h (BUF_COMPACT): New macro to follow the common style. + * buffer.c (Fget_buffer_create): Use it to set compact field of + struct buffer_text to avoid accessing an uninitialized value + when compact_buffer is called for the first time. + (compact_buffer): Use convenient BUF_COMPACT and BUF_MODIFF. + 2012-12-23 Eli Zaretskii <eliz@gnu.org> * w32.c (acl_set_file): If setting the file security descriptor diff --git a/src/buffer.c b/src/buffer.c index 3cf590d4db7..21c42fc82b7 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -575,6 +575,7 @@ even if it is dead. The return value is never nil. */) BUF_CHARS_MODIFF (b) = 1; BUF_OVERLAY_MODIFF (b) = 1; BUF_SAVE_MODIFF (b) = 1; + BUF_COMPACT (b) = 1; set_buffer_intervals (b, NULL); BUF_UNCHANGED_MODIFIED (b) = 1; BUF_OVERLAY_UNCHANGED_MODIFIED (b) = 1; @@ -1669,7 +1670,7 @@ compact_buffer (struct buffer *buffer) which aren't changed since last compaction. */ if (BUFFER_LIVE_P (buffer) && (buffer->base_buffer == NULL) - && (buffer->text->compact != buffer->text->modiff)) + && (BUF_COMPACT (buffer) != BUF_MODIFF (buffer))) { /* If a buffer's undo list is Qt, that means that undo is turned off in that buffer. Calling truncate_undo_list on @@ -1694,7 +1695,7 @@ compact_buffer (struct buffer *buffer) current_buffer = save_current; } } - buffer->text->compact = buffer->text->modiff; + BUF_COMPACT (buffer) = BUF_MODIFF (buffer); } } diff --git a/src/buffer.h b/src/buffer.h index d838d3767ef..a8769fd3397 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -193,6 +193,9 @@ INLINE_HEADER_BEGIN /* FIXME: should we move this into ->text->auto_save_modiff? */ #define BUF_AUTOSAVE_MODIFF(buf) ((buf)->auto_save_modified) +/* Compaction count. */ +#define BUF_COMPACT(buf) ((buf)->text->compact) + /* Marker chain of buffer. */ #define BUF_MARKERS(buf) ((buf)->text->markers) |