[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 08/16] Combine unnecessarily separate loops in buffer.c
From: |
Spencer Baugh |
Subject: |
[PATCH v2 08/16] Combine unnecessarily separate loops in buffer.c |
Date: |
Sat, 21 Nov 2020 21:34:37 -0500 |
These loops iterate over the same things with the same check.
---
src/buffer.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/buffer.c b/src/buffer.c
index a0bcbf38e5..5333db73bd 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -984,7 +984,7 @@ reset_buffer (register struct buffer *b)
static void
reset_buffer_local_variables (struct buffer *b, bool permanent_too)
{
- int offset, i;
+ int offset;
/* Reset the major mode to Fundamental, together with all the
things that depend on the major mode.
@@ -1078,10 +1078,6 @@ reset_buffer_local_variables (struct buffer *b, bool
permanent_too)
}
}
- for (i = 0; i < last_per_buffer_idx; ++i)
- if (permanent_too || buffer_permanent_local_flags[i] == 0)
- SET_PER_BUFFER_VALUE_P (b, i, 0);
-
/* For each slot that has a default value, copy that into the slot. */
FOR_EACH_PER_BUFFER_OBJECT_AT (offset)
{
@@ -1089,7 +1085,10 @@ reset_buffer_local_variables (struct buffer *b, bool
permanent_too)
if ((idx > 0
&& (permanent_too
|| buffer_permanent_local_flags[idx] == 0)))
- set_per_buffer_value (b, offset, per_buffer_default (offset));
+ {
+ SET_PER_BUFFER_VALUE_P (b, idx, 0);
+ set_per_buffer_value (b, offset, per_buffer_default (offset));
+ }
}
}
--
2.28.0
- [PATCH v2 00/16] Speeding up DEFVAR_PER_BUFFER, (continued)
- [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
- [PATCH v2 03/16] Stop checking the constant default for enable_multibyte_characters, Spencer Baugh, 2020/11/21
- Re: [PATCH v2 03/16] Stop checking the constant default for enable_multibyte_characters, Stefan Monnier, 2020/11/25
- [PATCH v2 04/16] Take buffer field name in DEFVAR_PER_BUFFER, Spencer Baugh, 2020/11/21
- [PATCH v2 08/16] Combine unnecessarily separate loops in buffer.c,
Spencer Baugh <=
- [PATCH v2 09/16] Add and use BUFFER_DEFAULT_VALUE_P, Spencer Baugh, 2020/11/21
- [PATCH v2 06/16] Use bset_* functions instead of BVAR, Spencer Baugh, 2020/11/21
- [PATCH v2 07/16] Take offset not idx in PER_BUFFER_VALUE_P, Spencer Baugh, 2020/11/21
- [PATCH v2 11/16] Assert that PER_BUFFER_IDX for Lisp variables is not 0, Spencer Baugh, 2020/11/21
- [PATCH v2 14/16] Remove unnecessary Qunbound check, Spencer Baugh, 2020/11/21
- [PATCH v2 10/16] Add and use KILL_PER_BUFFER_VALUE, Spencer Baugh, 2020/11/21
- [PATCH v2 13/16] Get rid of buffer_permanent_local_flags array, Spencer Baugh, 2020/11/21
- Re: [PATCH v2 13/16] Get rid of buffer_permanent_local_flags array, Eli Zaretskii, 2020/11/22
- [PATCH v2 12/16] Rearrange set_internal for buffer forwarded symbols, Spencer Baugh, 2020/11/21
- [PATCH v2 15/16] Remove local_flags array in struct buffer, Spencer Baugh, 2020/11/21