summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Brinkhoff <lars@nocrew.org>2017-04-03 08:42:18 +0200
committerLars Brinkhoff <lars@nocrew.org>2017-04-10 08:32:23 +0200
commitc9b173eff5154cfd2d7567cdf400e48c88fd51d2 (patch)
treee87ce1ccc69052906f8713f4720d9578be6e5534
parent0fb52dcc45742af58a081bd6ca27b70f6a6a1899 (diff)
downloademacs-scratch/pvsize.tar.gz
Please revew: PVSIZE, pseudovector size.scratch/pvsize
-rw-r--r--src/chartab.c2
-rw-r--r--src/data.c9
-rw-r--r--src/doc.c4
-rw-r--r--src/eval.c9
-rw-r--r--src/fns.c5
-rw-r--r--src/font.h6
-rw-r--r--src/lisp.h6
-rw-r--r--src/lread.c2
-rw-r--r--src/print.c2
9 files changed, 24 insertions, 21 deletions
diff --git a/src/chartab.c b/src/chartab.c
index fa5a8e41164..8392c0c07dc 100644
--- a/src/chartab.c
+++ b/src/chartab.c
@@ -185,7 +185,7 @@ Lisp_Object
copy_char_table (Lisp_Object table)
{
Lisp_Object copy;
- int size = XCHAR_TABLE (table)->header.size & PSEUDOVECTOR_SIZE_MASK;
+ int size = PVSIZE (table);
int i;
copy = Fmake_vector (make_number (size), Qnil);
diff --git a/src/data.c b/src/data.c
index 903e809d235..141b26ccf35 100644
--- a/src/data.c
+++ b/src/data.c
@@ -270,7 +270,7 @@ for example, (type-of 1) returns `integer'. */)
case PVEC_RECORD:
{
Lisp_Object t = AREF (object, 0);
- if (RECORDP (t) && 1 < (ASIZE (t) & PSEUDOVECTOR_SIZE_MASK))
+ if (RECORDP (t) && 1 < PVSIZE (t))
/* Return the type name field of the class! */
return AREF (t, 1);
else
@@ -902,7 +902,7 @@ Value, if non-nil, is a list (interactive SPEC). */)
}
else if (COMPILEDP (fun))
{
- if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE)
+ if (PVSIZE (fun) > COMPILED_INTERACTIVE)
return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE));
}
else if (AUTOLOADP (fun))
@@ -2306,7 +2306,7 @@ or a byte-code object. IDX starts at 0. */)
if (VECTORP (array))
size = ASIZE (array);
else if (COMPILEDP (array) || RECORDP (array))
- size = ASIZE (array) & PSEUDOVECTOR_SIZE_MASK;
+ size = PVSIZE (array);
else
wrong_type_argument (Qarrayp, array);
@@ -2349,8 +2349,7 @@ bool-vector. IDX starts at 0. */)
}
else if (RECORDP (array))
{
- ptrdiff_t size = ASIZE (array) & PSEUDOVECTOR_SIZE_MASK;
- if (idxval < 0 || idxval >= size)
+ if (idxval < 0 || idxval >= PVSIZE (array))
args_out_of_range (array, idx);
ASET (array, idxval, newelt);
}
diff --git a/src/doc.c b/src/doc.c
index 1e7e3fcf6a6..dd674e3bc05 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -342,7 +342,7 @@ string is passed through `substitute-command-keys'. */)
doc = make_number (XSUBR (fun)->doc);
else if (COMPILEDP (fun))
{
- if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) <= COMPILED_DOC_STRING)
+ if (PVSIZE (fun) <= COMPILED_DOC_STRING)
return Qnil;
else
{
@@ -500,7 +500,7 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset)
{
/* This bytecode object must have a slot for the
docstring, since we've found a docstring for it. */
- if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_DOC_STRING)
+ if (PVSIZE (fun) > COMPILED_DOC_STRING)
ASET (fun, COMPILED_DOC_STRING, make_number (offset));
else
{
diff --git a/src/eval.c b/src/eval.c
index 16d1cf810ea..af0912fd14f 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1881,8 +1881,7 @@ then strings and vectors are not accepted. */)
have an element whose index is COMPILED_INTERACTIVE, which is
where the interactive spec is stored. */
else if (COMPILEDP (fun))
- return ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE
- ? Qt : if_prop);
+ return (PVSIZE (fun) > COMPILED_INTERACTIVE ? Qt : if_prop);
/* Strings and vectors are keyboard macros. */
if (STRINGP (fun) || VECTORP (fun))
@@ -2922,7 +2921,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
}
else if (COMPILEDP (fun))
{
- ptrdiff_t size = ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK;
+ ptrdiff_t size = PVSIZE (fun);
if (size <= COMPILED_STACK_DEPTH)
xsignal1 (Qinvalid_function, fun);
syms_left = AREF (fun, COMPILED_ARGLIST);
@@ -3103,7 +3102,7 @@ lambda_arity (Lisp_Object fun)
}
else if (COMPILEDP (fun))
{
- ptrdiff_t size = ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK;
+ ptrdiff_t size = PVSIZE (fun);
if (size <= COMPILED_STACK_DEPTH)
xsignal1 (Qinvalid_function, fun);
syms_left = AREF (fun, COMPILED_ARGLIST);
@@ -3148,7 +3147,7 @@ DEFUN ("fetch-bytecode", Ffetch_bytecode, Sfetch_bytecode,
if (COMPILEDP (object))
{
- ptrdiff_t size = ASIZE (object) & PSEUDOVECTOR_SIZE_MASK;
+ ptrdiff_t size = PVSIZE (object);
if (size <= COMPILED_STACK_DEPTH)
xsignal1 (Qinvalid_function, object);
if (CONSP (AREF (object, COMPILED_BYTECODE)))
diff --git a/src/fns.c b/src/fns.c
index 2f07c2ccfb7..10d35b6112a 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -107,7 +107,7 @@ To get the number of bytes, use `string-bytes'. */)
else if (BOOL_VECTOR_P (sequence))
XSETFASTINT (val, bool_vector_size (sequence));
else if (COMPILEDP (sequence) || RECORDP (sequence))
- XSETFASTINT (val, ASIZE (sequence) & PSEUDOVECTOR_SIZE_MASK);
+ XSETFASTINT (val, PVSIZE (sequence));
else if (CONSP (sequence))
{
intptr_t i = 0;
@@ -484,8 +484,7 @@ shared with the original. */)
if (RECORDP (arg))
{
- ptrdiff_t size = ASIZE (arg) & PSEUDOVECTOR_SIZE_MASK;
- return Frecord (size, XVECTOR (arg)->contents);
+ return Frecord (PVSIZE (arg), XVECTOR (arg)->contents);
}
if (CHAR_TABLE_P (arg))
diff --git a/src/font.h b/src/font.h
index a469b20e4f4..53e3fc21a3d 100644
--- a/src/font.h
+++ b/src/font.h
@@ -424,7 +424,7 @@ FONTP (Lisp_Object x)
INLINE bool
FONT_SPEC_P (Lisp_Object x)
{
- return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_SPEC_MAX;
+ return FONTP (x) && PVSIZE (x) == FONT_SPEC_MAX;
}
/* Like FONT_SPEC_P, but can be used in the garbage collector. */
@@ -438,7 +438,7 @@ GC_FONT_SPEC_P (Lisp_Object x)
INLINE bool
FONT_ENTITY_P (Lisp_Object x)
{
- return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_ENTITY_MAX;
+ return FONTP (x) && PVSIZE (x) == FONT_ENTITY_MAX;
}
/* Like FONT_ENTITY_P, but can be used in the garbage collector. */
@@ -452,7 +452,7 @@ GC_FONT_ENTITY_P (Lisp_Object x)
INLINE bool
FONT_OBJECT_P (Lisp_Object x)
{
- return FONTP (x) && (ASIZE (x) & PSEUDOVECTOR_SIZE_MASK) == FONT_OBJECT_MAX;
+ return FONTP (x) && PVSIZE (x) == FONT_OBJECT_MAX;
}
/* Like FONT_OBJECT_P, but can be used in the garbage collector. */
diff --git a/src/lisp.h b/src/lisp.h
index 5e7d41bc5d5..678e261c1da 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1401,6 +1401,12 @@ ASIZE (Lisp_Object array)
return size;
}
+INLINE ptrdiff_t
+PVSIZE (Lisp_Object pv)
+{
+ return ASIZE (pv) & PSEUDOVECTOR_SIZE_MASK;
+}
+
INLINE bool
VECTORP (Lisp_Object x)
{
diff --git a/src/lread.c b/src/lread.c
index 513f63e4315..3b2e123dd39 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3402,7 +3402,7 @@ substitute_object_recurse (Lisp_Object object, Lisp_Object placeholder, Lisp_Obj
else if (CHAR_TABLE_P (subtree) || SUB_CHAR_TABLE_P (subtree)
|| COMPILEDP (subtree) || HASH_TABLE_P (subtree)
|| RECORDP (subtree))
- length = ASIZE (subtree) & PSEUDOVECTOR_SIZE_MASK;
+ length = PVSIZE (subtree);
else if (VECTORP (subtree))
length = ASIZE (subtree);
else
diff --git a/src/print.c b/src/print.c
index 76f263994e6..872103bd4c2 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1966,7 +1966,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
case PVEC_RECORD:
{
- ptrdiff_t n, size = ASIZE (obj) & PSEUDOVECTOR_SIZE_MASK;
+ ptrdiff_t n, size = PVSIZE (obj);
int i;
/* Don't print more elements than the specified maximum. */