[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#48264: [PATCH v4 04/14] Combine unnecessarily separate loops in buff
From: |
Spencer Baugh |
Subject: |
bug#48264: [PATCH v4 04/14] Combine unnecessarily separate loops in buffer.c |
Date: |
Fri, 7 May 2021 22:08:55 -0400 |
These loops iterate over the same things with the same check.
* src/buffer.c (reset_buffer_local_variables): Combine loops.
---
src/buffer.c | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/src/buffer.c b/src/buffer.c
index efc85bf378..4336e10a27 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1006,7 +1006,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.
@@ -1100,10 +1100,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)
{
@@ -1111,7 +1107,10 @@ reset_buffer_local_variables (struct buffer *b, bool
permanent_too)
if ((BVAR_HAS_DEFAULT_VALUE_P (offset)
&& (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.31.1
- bug#48264: [PATCH v4 00/15] Speeding up setting the default for DEFVAR_PER_BUFFER vars, (continued)
- bug#48264: [PATCH v4 00/15] Speeding up setting the default for DEFVAR_PER_BUFFER vars, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 00/15] Speeding up setting the default for DEFVAR_PER_BUFFER vars, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 06/14] Rearrange set_internal for buffer forwarded symbols, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 11/14] Set buffer_defaults fields without a default to Qunbound, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 13/14] Remove PER_BUFFER_IDX and buffer_local_flags, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 14/14] Add and use BVAR_FIELD macros, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 05/14] Add and use KILL_PER_BUFFER_VALUE, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 03/14] Add and use BVAR_HAS_DEFAULT_VALUE_P, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 01/14] Stop checking the constant default for enable_multibyte_characters, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 02/14] Take offset not idx in PER_BUFFER_VALUE_P, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 04/14] Combine unnecessarily separate loops in buffer.c,
Spencer Baugh <=
- bug#48264: [PATCH v4 07/14] Use BVAR_OR_DEFAULT for per-buffer vars with defaults, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 10/14] Delete SET_PER_BUFFER_VALUE_P and buffer local_flags field, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 08/14] Remove unnecessary Qunbound check, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 09/14] Get rid of buffer_permanent_local_flags array, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 12/14] Assert that PER_BUFFER_IDX for Lisp variables is not 0, Spencer Baugh, 2021/05/07
- bug#48264: [PATCH v4 00/15] Speeding up setting the default for DEFVAR_PER_BUFFER vars, Stefan Monnier, 2021/05/08
- bug#48264: [PATCH v3 02/15] Take offset not idx in PER_BUFFER_VALUE_P, Spencer Baugh, 2021/05/06