[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 02/10] Add bset_save_length and use it
From: |
Spencer Baugh |
Subject: |
[PATCH 02/10] Add bset_save_length and use it |
Date: |
Thu, 19 Nov 2020 10:38:06 -0500 |
This removes some usage of BVAR as an lvalue, necessary for changing
BVAR into a function call.
---
src/buffer.c | 9 ++-------
src/buffer.h | 5 +++++
src/fileio.c | 12 ++++++------
3 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/src/buffer.c b/src/buffer.c
index 64d0a74fb0..e88bf23fad 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -332,11 +332,6 @@ bset_right_fringe_width (struct buffer *b, Lisp_Object val)
b->right_fringe_width_ = val;
}
static void
-bset_save_length (struct buffer *b, Lisp_Object val)
-{
- b->save_length_ = val;
-}
-static void
bset_scroll_bar_width (struct buffer *b, Lisp_Object val)
{
b->scroll_bar_width_ = val;
@@ -956,7 +951,7 @@ reset_buffer (register struct buffer *b)
bset_directory (b, current_buffer ? BVAR (current_buffer, directory) : Qnil);
b->modtime = make_timespec (0, UNKNOWN_MODTIME_NSECS);
b->modtime_size = -1;
- XSETFASTINT (BVAR (b, save_length), 0);
+ bset_save_length (b, make_fixed_natnum (0));
b->last_window_start = 1;
/* It is more conservative to start out "changed" than "unchanged". */
b->clip_changed = 0;
@@ -2282,7 +2277,7 @@ so the buffer is truly empty after this. */)
/* Prevent warnings, or suspension of auto saving, that would happen
if future size is less than past size. Use of erase-buffer
implies that the future text is not really related to the past text. */
- XSETFASTINT (BVAR (current_buffer, save_length), 0);
+ bset_save_length (current_buffer, make_fixed_natnum (0));
return Qnil;
}
diff --git a/src/buffer.h b/src/buffer.h
index 3da49414bb..690593757e 100644
--- a/src/buffer.h
+++ b/src/buffer.h
@@ -824,6 +824,11 @@ bset_width_table (struct buffer *b, Lisp_Object val)
{
b->width_table_ = val;
}
+INLINE void
+bset_save_length (struct buffer *b, Lisp_Object val)
+{
+ b->save_length_ = val;
+}
/* BUFFER_CEILING_OF (resp. BUFFER_FLOOR_OF), when applied to n, return
the max (resp. min) p such that
diff --git a/src/fileio.c b/src/fileio.c
index 283813ff89..ba094a5705 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -4697,7 +4697,7 @@ by calling `format-decode', which see. */)
SAVE_MODIFF = MODIFF;
BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
- XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
+ bset_save_length (current_buffer, make_fixed_natnum (Z - BEG));
if (NILP (handler))
{
if (!NILP (BVAR (current_buffer, file_truename)))
@@ -5110,7 +5110,7 @@ write_region (Lisp_Object start, Lisp_Object end,
Lisp_Object filename,
if (visiting)
{
SAVE_MODIFF = MODIFF;
- XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
+ bset_save_length (current_buffer, make_fixed_natnum (Z - BEG));
bset_filename (current_buffer, visit_file);
}
@@ -5361,7 +5361,7 @@ write_region (Lisp_Object start, Lisp_Object end,
Lisp_Object filename,
if (visiting)
{
SAVE_MODIFF = MODIFF;
- XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
+ bset_save_length (current_buffer, make_fixed_natnum (Z - BEG));
bset_filename (current_buffer, visit_file);
update_mode_lines = 14;
if (auto_saving_into_visited_file)
@@ -5979,7 +5979,7 @@ A non-nil CURRENT-ONLY argument means save only current
buffer. */)
minibuffer_auto_raise = 0;
/* Turn off auto-saving until there's a real save,
and prevent any more warnings. */
- XSETINT (BVAR (b, save_length), -1);
+ bset_save_length (current_buffer, make_fixed_natnum (-1));
Fsleep_for (make_fixnum (1), Qnil);
continue;
}
@@ -5988,7 +5988,7 @@ A non-nil CURRENT-ONLY argument means save only current
buffer. */)
internal_condition_case (auto_save_1, Qt, auto_save_error);
auto_saved = 1;
BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b);
- XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
+ bset_save_length (current_buffer, make_fixed_natnum (Z - BEG));
set_buffer_internal (old);
after_time = current_timespec ();
@@ -6034,7 +6034,7 @@ No auto-save file will be written until the buffer
changes again. */)
/* FIXME: This should not be called in indirect buffers, since
they're not autosaved. */
BUF_AUTOSAVE_MODIFF (current_buffer) = MODIFF;
- XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG);
+ bset_save_length (current_buffer, make_fixed_natnum (Z - BEG));
current_buffer->auto_save_failure_time = 0;
return Qnil;
}
--
2.28.0
- ido-switch-buffer is slow with many buffers; others are fast, catern, 2020/11/14
- Re: ido-switch-buffer is slow with many buffers; others are fast, Stefan Monnier, 2020/11/14
- Re: ido-switch-buffer is slow with many buffers; others are fast, Dmitry Gutov, 2020/11/14
- Re: ido-switch-buffer is slow with many buffers; others are fast, Spencer Baugh, 2020/11/14
- Re: ido-switch-buffer is slow with many buffers; others are fast, Stefan Monnier, 2020/11/15
- Re: ido-switch-buffer is slow with many buffers; others are fast, Spencer Baugh, 2020/11/15
- Re: ido-switch-buffer is slow with many buffers; others are fast, Arnold Noronha, 2020/11/15
- [PATCH 02/10] Add bset_save_length and use it,
Spencer Baugh <=
- [PATCH 04/10] Use bset_enable_multibyte_characters everywhere, Spencer Baugh, 2020/11/19
- [PATCH 00/10] Speeding up DEFVAR_PER_BUFFER (Was: ido-switch-buffer is slow), Spencer Baugh, 2020/11/19
- Re: [PATCH 00/10] Speeding up DEFVAR_PER_BUFFER, Stefan Monnier, 2020/11/19
- [PATCH v2 00/16] Speeding up DEFVAR_PER_BUFFER, Spencer Baugh, 2020/11/21
- [PATCH v2 01/16] Add a test for let-binding unwinding, Spencer Baugh, 2020/11/21
- Re: [PATCH v2 01/16] Add a test for let-binding unwinding, Stefan Monnier, 2020/11/25
- Re: [PATCH v2 01/16] Add a test for let-binding unwinding, Spencer Baugh, 2020/11/30
- [PATCH v2 05/16] Add BVAR_DEFAULT for access to buffer defaults, Spencer Baugh, 2020/11/21
- [PATCH v2 02/16] Assert not local-variable-p after setq in let_default binding, Spencer Baugh, 2020/11/21
- Re: [PATCH v2 02/16] Assert not local-variable-p after setq in let_default binding, Stefan Monnier, 2020/11/25