diff options
| author | Paul Eggert | 2011-06-14 11:57:19 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-06-14 11:57:19 -0700 |
| commit | f66c7cf8f794d6f7fd9ccb8794ffc519e4e89795 (patch) | |
| tree | 0de26b21c827049c7fa2485204ecf0e2d632b849 /src/coding.c | |
| parent | a1759b76246a21c7c07dc2ee00b8db792715104c (diff) | |
| download | emacs-f66c7cf8f794d6f7fd9ccb8794ffc519e4e89795.tar.gz emacs-f66c7cf8f794d6f7fd9ccb8794ffc519e4e89795.zip | |
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.
Diffstat (limited to 'src/coding.c')
| -rw-r--r-- | src/coding.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/coding.c b/src/coding.c index d914e0d641b..04985ab3c74 100644 --- a/src/coding.c +++ b/src/coding.c | |||
| @@ -9278,7 +9278,7 @@ function to call for FILENAME, that function should examine the | |||
| 9278 | contents of BUFFER instead of reading the file. | 9278 | contents of BUFFER instead of reading the file. |
| 9279 | 9279 | ||
| 9280 | usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) | 9280 | usage: (find-operation-coding-system OPERATION ARGUMENTS...) */) |
| 9281 | (size_t nargs, Lisp_Object *args) | 9281 | (ptrdiff_t nargs, Lisp_Object *args) |
| 9282 | { | 9282 | { |
| 9283 | Lisp_Object operation, target_idx, target, val; | 9283 | Lisp_Object operation, target_idx, target, val; |
| 9284 | register Lisp_Object chain; | 9284 | register Lisp_Object chain; |
| @@ -9355,9 +9355,9 @@ If multiple coding systems belong to the same category, | |||
| 9355 | all but the first one are ignored. | 9355 | all but the first one are ignored. |
| 9356 | 9356 | ||
| 9357 | usage: (set-coding-system-priority &rest coding-systems) */) | 9357 | usage: (set-coding-system-priority &rest coding-systems) */) |
| 9358 | (size_t nargs, Lisp_Object *args) | 9358 | (ptrdiff_t nargs, Lisp_Object *args) |
| 9359 | { | 9359 | { |
| 9360 | size_t i, j; | 9360 | ptrdiff_t i, j; |
| 9361 | int changed[coding_category_max]; | 9361 | int changed[coding_category_max]; |
| 9362 | enum coding_category priorities[coding_category_max]; | 9362 | enum coding_category priorities[coding_category_max]; |
| 9363 | 9363 | ||
| @@ -9461,7 +9461,7 @@ DEFUN ("define-coding-system-internal", Fdefine_coding_system_internal, | |||
| 9461 | Sdefine_coding_system_internal, coding_arg_max, MANY, 0, | 9461 | Sdefine_coding_system_internal, coding_arg_max, MANY, 0, |
| 9462 | doc: /* For internal use only. | 9462 | doc: /* For internal use only. |
| 9463 | usage: (define-coding-system-internal ...) */) | 9463 | usage: (define-coding-system-internal ...) */) |
| 9464 | (size_t nargs, Lisp_Object *args) | 9464 | (ptrdiff_t nargs, Lisp_Object *args) |
| 9465 | { | 9465 | { |
| 9466 | Lisp_Object name; | 9466 | Lisp_Object name; |
| 9467 | Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ | 9467 | Lisp_Object spec_vec; /* [ ATTRS ALIASE EOL_TYPE ] */ |