diff options
| author | Lars Brinkhoff | 2017-04-03 08:42:18 +0200 |
|---|---|---|
| committer | Lars Brinkhoff | 2017-04-10 20:35:13 +0200 |
| commit | 3ccd0ff1064a2836c379b13c2d5f4b11c5da1f88 (patch) | |
| tree | 29393d7ce726f222d0f82ddfbb1363b0364168e7 /src/data.c | |
| parent | dd42ca427cf8a890678f574de43685ae70416491 (diff) | |
| download | emacs-3ccd0ff1064a2836c379b13c2d5f4b11c5da1f88.tar.gz emacs-3ccd0ff1064a2836c379b13c2d5f4b11c5da1f88.zip | |
Add PVSIZE function to return the size of a pseudovector.
* src/lisp.h (PVSIZE): New function.
* src/chartab.c (copy_char_table):
* src/data.c (Ftype_of, Finteractive_form, Faref, Faset):
* src/doc.c (Fdocumentation, store_function_docstring):
* src/eval.c (Fcommandp, funcall_lambda, lambda_arity, Ffetch_bytecode):
* src/fns.c (Flength, Fcopy_sequence):
* src/font.h (FONT_SPEC_P, FONT_ENTITY_P, FONT_OBJECT_P):
* src/lread.c (substitute_object_recurse):
* src/src/print.c (print_object):
Use it.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 9 |
1 files changed, 4 insertions, 5 deletions
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'. */) | |||
| 270 | case PVEC_RECORD: | 270 | case PVEC_RECORD: |
| 271 | { | 271 | { |
| 272 | Lisp_Object t = AREF (object, 0); | 272 | Lisp_Object t = AREF (object, 0); |
| 273 | if (RECORDP (t) && 1 < (ASIZE (t) & PSEUDOVECTOR_SIZE_MASK)) | 273 | if (RECORDP (t) && 1 < PVSIZE (t)) |
| 274 | /* Return the type name field of the class! */ | 274 | /* Return the type name field of the class! */ |
| 275 | return AREF (t, 1); | 275 | return AREF (t, 1); |
| 276 | else | 276 | else |
| @@ -902,7 +902,7 @@ Value, if non-nil, is a list (interactive SPEC). */) | |||
| 902 | } | 902 | } |
| 903 | else if (COMPILEDP (fun)) | 903 | else if (COMPILEDP (fun)) |
| 904 | { | 904 | { |
| 905 | if ((ASIZE (fun) & PSEUDOVECTOR_SIZE_MASK) > COMPILED_INTERACTIVE) | 905 | if (PVSIZE (fun) > COMPILED_INTERACTIVE) |
| 906 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); | 906 | return list2 (Qinteractive, AREF (fun, COMPILED_INTERACTIVE)); |
| 907 | } | 907 | } |
| 908 | else if (AUTOLOADP (fun)) | 908 | else if (AUTOLOADP (fun)) |
| @@ -2306,7 +2306,7 @@ or a byte-code object. IDX starts at 0. */) | |||
| 2306 | if (VECTORP (array)) | 2306 | if (VECTORP (array)) |
| 2307 | size = ASIZE (array); | 2307 | size = ASIZE (array); |
| 2308 | else if (COMPILEDP (array) || RECORDP (array)) | 2308 | else if (COMPILEDP (array) || RECORDP (array)) |
| 2309 | size = ASIZE (array) & PSEUDOVECTOR_SIZE_MASK; | 2309 | size = PVSIZE (array); |
| 2310 | else | 2310 | else |
| 2311 | wrong_type_argument (Qarrayp, array); | 2311 | wrong_type_argument (Qarrayp, array); |
| 2312 | 2312 | ||
| @@ -2349,8 +2349,7 @@ bool-vector. IDX starts at 0. */) | |||
| 2349 | } | 2349 | } |
| 2350 | else if (RECORDP (array)) | 2350 | else if (RECORDP (array)) |
| 2351 | { | 2351 | { |
| 2352 | ptrdiff_t size = ASIZE (array) & PSEUDOVECTOR_SIZE_MASK; | 2352 | if (idxval < 0 || idxval >= PVSIZE (array)) |
| 2353 | if (idxval < 0 || idxval >= size) | ||
| 2354 | args_out_of_range (array, idx); | 2353 | args_out_of_range (array, idx); |
| 2355 | ASET (array, idxval, newelt); | 2354 | ASET (array, idxval, newelt); |
| 2356 | } | 2355 | } |