summaryrefslogtreecommitdiff
path: root/src/buffer.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-09-03 21:54:58 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-09-03 22:46:11 -0700
commit97cfda2638afc7fed6ac7e465c6fe927f428a932 (patch)
treeab634688fc29cfd75b013ae274b70c80cd426eea /src/buffer.c
parent9117a667908064a0b4ae6ec6c8f3674d95ad6225 (diff)
downloademacs-97cfda2638afc7fed6ac7e465c6fe927f428a932.tar.gz
Take last_per_buffer_idx private
This will simplify future changes. Turn the runtime check into an eassert, since it’s not needed in production. * src/buffer.c (last_per_buffer_idx): Now static. (valid_per_buffer_idx): New function. * src/buffer.h (PER_BUFFER_VALUE_P, SET_PER_BUFFER_VALUE_P): Use it.
Diffstat (limited to 'src/buffer.c')
-rw-r--r--src/buffer.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 62a3d66c8b7..77e8b6bb779 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -105,7 +105,7 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
/* Number of per-buffer variables used. */
-int last_per_buffer_idx;
+static int last_per_buffer_idx;
static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
bool after, Lisp_Object arg1,
@@ -655,6 +655,12 @@ set_buffer_overlays_after (struct buffer *b, struct Lisp_Overlay *o)
b->overlays_after = o;
}
+bool
+valid_per_buffer_idx (int idx)
+{
+ return 0 <= idx && idx < last_per_buffer_idx;
+}
+
/* Clone per-buffer values of buffer FROM.
Buffer TO gets the same per-buffer values as FROM, with the