mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-18 11:50:38 -08:00
Variadic C functions now count arguments with ptrdiff_t.
This partly undoes my 2011-03-30 change, which replaced int with size_t. Back then I didn't know that the Emacs coding style prefers signed int. Also, in the meantime I found a few more instances where arguments were being counted with int, which may truncate counts on 64-bit machines, or EMACS_INT, which may be unnecessarily wide. * lisp.h (struct Lisp_Subr.function.aMANY) (DEFUN_ARGS_MANY, internal_condition_case_n, safe_call): Arg counts are now ptrdiff_t, not size_t. All variadic functions and their callers changed accordingly. (struct gcpro.nvars): Now size_t, not size_t. All uses changed. * bytecode.c (exec_byte_code): Check maxdepth for overflow, to avoid potential buffer overrun. Don't assume arg counts fit in 'int'. * callint.c (Fcall_interactively): Check arg count for overflow, to avoid potential buffer overrun. Use signed char, not 'int', for 'varies' array, so that we needn't bother to check its size calculation for overflow. * editfns.c (Fformat): Use ptrdiff_t, not EMACS_INT, to count args. * eval.c (apply_lambda): * fns.c (Fmapconcat): Use XFASTINT, not XINT, to get args length. (struct textprop_rec.argnum): Now ptrdiff_t, not int. All uses changed. (mapconcat): Use ptrdiff_t, not int and EMACS_INT, to count args.
This commit is contained in:
parent
a1759b7624
commit
f66c7cf8f7
19 changed files with 188 additions and 161 deletions
|
|
@ -9278,7 +9278,7 @@ function to call for FILENAME, that function should examine the
|
|||
contents of BUFFER instead of reading the file.
|
||||
|
||||
usage: (find-operation-coding-system OPERATION ARGUMENTS...) */)
|
||||
(size_t nargs, Lisp_Object *args)
|
||||
(ptrdiff_t nargs, Lisp_Object *args)
|
||||
{
|
||||
Lisp_Object operation, target_idx, target, val;
|
||||
register Lisp_Object chain;
|
||||
|
|
@ -9355,9 +9355,9 @@ If multiple coding systems belong to the same category,
|
|||
all but the first one are ignored.
|
||||
|
||||
usage: (set-coding-system-priority &rest coding-systems) */)
|
||||
(size_t nargs, Lisp_Object *args)
|
||||
(ptrdiff_t nargs, Lisp_Object *args)
|
||||
{
|
||||
size_t i, j;
|
||||
ptrdiff_t i, j;
|
||||
int changed[coding_category_max];
|
||||
enum coding_category priorities[coding_category_max];
|
||||
|
||||
|
|
@ -9461,7 +9461,7 @@ DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal,
|
|||
Sdefine_coding_system_internal, coding_arg_max, MANY, 0,
|
||||
doc: /* For internal use only.
|
||||
usage: (define-coding-system-internal ...) */)
|
||||
(size_t nargs, Lisp_Object *args)
|
||||
(ptrdiff_t nargs, Lisp_Object *args)
|
||||
{
|
||||
Lisp_Object name;
|
||||
Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue