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/charset.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/charset.c')
| -rw-r--r-- | src/charset.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/charset.c b/src/charset.c index 29f98f24089..55234aa76aa 100644 --- a/src/charset.c +++ b/src/charset.c | |||
| @@ -844,7 +844,7 @@ DEFUN ("define-charset-internal", Fdefine_charset_internal, | |||
| 844 | Sdefine_charset_internal, charset_arg_max, MANY, 0, | 844 | Sdefine_charset_internal, charset_arg_max, MANY, 0, |
| 845 | doc: /* For internal use only. | 845 | doc: /* For internal use only. |
| 846 | usage: (define-charset-internal ...) */) | 846 | usage: (define-charset-internal ...) */) |
| 847 | (size_t nargs, Lisp_Object *args) | 847 | (ptrdiff_t nargs, Lisp_Object *args) |
| 848 | { | 848 | { |
| 849 | /* Charset attr vector. */ | 849 | /* Charset attr vector. */ |
| 850 | Lisp_Object attrs; | 850 | Lisp_Object attrs; |
| @@ -2145,11 +2145,11 @@ DEFUN ("set-charset-priority", Fset_charset_priority, Sset_charset_priority, | |||
| 2145 | 1, MANY, 0, | 2145 | 1, MANY, 0, |
| 2146 | doc: /* Assign higher priority to the charsets given as arguments. | 2146 | doc: /* Assign higher priority to the charsets given as arguments. |
| 2147 | usage: (set-charset-priority &rest charsets) */) | 2147 | usage: (set-charset-priority &rest charsets) */) |
| 2148 | (size_t nargs, Lisp_Object *args) | 2148 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2149 | { | 2149 | { |
| 2150 | Lisp_Object new_head, old_list, arglist[2]; | 2150 | Lisp_Object new_head, old_list, arglist[2]; |
| 2151 | Lisp_Object list_2022, list_emacs_mule; | 2151 | Lisp_Object list_2022, list_emacs_mule; |
| 2152 | size_t i; | 2152 | ptrdiff_t i; |
| 2153 | int id; | 2153 | int id; |
| 2154 | 2154 | ||
| 2155 | old_list = Fcopy_sequence (Vcharset_ordered_list); | 2155 | old_list = Fcopy_sequence (Vcharset_ordered_list); |