aboutsummaryrefslogtreecommitdiffstats
path: root/src/charset.c
diff options
context:
space:
mode:
authorPaul Eggert <[email protected]>2011-06-14 11:57:19 -0700
committerPaul Eggert <[email protected]>2011-06-14 11:57:19 -0700
commitf66c7cf8f794d6f7fd9ccb8794ffc519e4e89795 (patch)
tree0de26b21c827049c7fa2485204ecf0e2d632b849 /src/charset.c
parenta1759b76246a21c7c07dc2ee00b8db792715104c (diff)
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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/charset.c b/src/charset.c
index 29f98f2408..55234aa76a 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -844,7 +844,7 @@ DEFUN ("define-charset-internal", Fdefine_charset_internal,
Sdefine_charset_internal, charset_arg_max, MANY, 0,
doc: /* For internal use only.
usage: (define-charset-internal ...) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
/* Charset attr vector. */
Lisp_Object attrs;
@@ -2145,11 +2145,11 @@ DEFUN ("set-charset-priority", Fset_charset_priority, Sset_charset_priority,
1, MANY, 0,
doc: /* Assign higher priority to the charsets given as arguments.
usage: (set-charset-priority &rest charsets) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object new_head, old_list, arglist[2];
Lisp_Object list_2022, list_emacs_mule;
- size_t i;
+ ptrdiff_t i;
int id;
old_list = Fcopy_sequence (Vcharset_ordered_list);