summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-06-14 11:57:19 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2011-06-14 11:57:19 -0700
commitf66c7cf8f794d6f7fd9ccb8794ffc519e4e89795 (patch)
tree0de26b21c827049c7fa2485204ecf0e2d632b849
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.
-rw-r--r--src/ChangeLog23
-rw-r--r--src/alloc.c16
-rw-r--r--src/bytecode.c14
-rw-r--r--src/callint.c12
-rw-r--r--src/callproc.c12
-rw-r--r--src/character.c8
-rw-r--r--src/charset.c6
-rw-r--r--src/coding.c8
-rw-r--r--src/data.c34
-rw-r--r--src/dbusbind.c50
-rw-r--r--src/editfns.c34
-rw-r--r--src/eval.c55
-rw-r--r--src/fns.c37
-rw-r--r--src/font.c4
-rw-r--r--src/frame.c2
-rw-r--r--src/keyboard.c2
-rw-r--r--src/lisp.h16
-rw-r--r--src/process.c12
-rw-r--r--src/xdisp.c4
19 files changed, 188 insertions, 161 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index e4e95ba5aa..dc8f983c87 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,28 @@
2011-06-14 Paul Eggert <eggert@cs.ucla.edu>
+ 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 be too narrow, or EMACS_INT, which
+ may be too 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.
+
* callint.c (Fcall_interactively): Don't use index var as event count.
* vm-limit.c (check_memory_limits): Fix incorrect extern function decls.
diff --git a/src/alloc.c b/src/alloc.c
index fd2884af1c..56e8eb4d46 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -2697,7 +2697,7 @@ DEFUN ("list", Flist, Slist, 0, MANY, 0,
doc: /* Return a newly created list with specified arguments as elements.
Any number of arguments, even zero arguments, are allowed.
usage: (list &rest OBJECTS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
register Lisp_Object val;
val = Qnil;
@@ -2913,10 +2913,10 @@ DEFUN ("vector", Fvector, Svector, 0, MANY, 0,
doc: /* Return a newly created vector with specified arguments as elements.
Any number of arguments, even zero arguments, are allowed.
usage: (vector &rest OBJECTS) */)
- (register size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
register Lisp_Object len, val;
- register size_t i;
+ ptrdiff_t i;
register struct Lisp_Vector *p;
XSETFASTINT (len, nargs);
@@ -2944,15 +2944,15 @@ argument to catch the left-over arguments. If such an integer is used, the
arguments will not be dynamically bound but will be instead pushed on the
stack before executing the byte-code.
usage: (make-byte-code ARGLIST BYTE-CODE CONSTANTS DEPTH &optional DOCSTRING INTERACTIVE-SPEC &rest ELEMENTS) */)
- (register size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
register Lisp_Object len, val;
- register size_t i;
+ ptrdiff_t i;
register struct Lisp_Vector *p;
XSETFASTINT (len, nargs);
if (!NILP (Vpurify_flag))
- val = make_pure_vector ((EMACS_INT) nargs);
+ val = make_pure_vector (nargs);
else
val = Fmake_vector (len, Qnil);
@@ -4238,7 +4238,7 @@ static void
check_gcpros (void)
{
struct gcpro *p;
- size_t i;
+ ptrdiff_t i;
for (p = gcprolist; p; p = p->next)
for (i = 0; i < p->nvars; ++i)
@@ -4848,7 +4848,7 @@ returns nil, because real GC can't be done. */)
{
register struct specbinding *bind;
char stack_top_variable;
- register size_t i;
+ ptrdiff_t i;
int message_p;
Lisp_Object total[8];
int count = SPECPDL_INDEX ();
diff --git a/src/bytecode.c b/src/bytecode.c
index 74cf401bf1..adc9352fb6 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -433,7 +433,7 @@ If the third argument is incorrect, Emacs may crash. */)
Lisp_Object
exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
- Lisp_Object args_template, int nargs, Lisp_Object *args)
+ Lisp_Object args_template, ptrdiff_t nargs, Lisp_Object *args)
{
int count = SPECPDL_INDEX ();
#ifdef BYTE_CODE_METER
@@ -464,7 +464,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
CHECK_STRING (bytestr);
CHECK_VECTOR (vector);
- CHECK_NUMBER (maxdepth);
+ CHECK_NATNUM (maxdepth);
#ifdef BYTE_CODE_SAFE
const_length = ASIZE (vector);
@@ -486,6 +486,8 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
stack.byte_string = bytestr;
stack.pc = stack.byte_string_start = SDATA (bytestr);
stack.constants = vector;
+ if (min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object) < XFASTINT (maxdepth))
+ memory_full (SIZE_MAX);
top = (Lisp_Object *) alloca (XFASTINT (maxdepth)
* sizeof (Lisp_Object));
#if BYTE_MAINTAIN_TOP
@@ -502,14 +504,14 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
if (INTEGERP (args_template))
{
- int at = XINT (args_template);
+ ptrdiff_t at = XINT (args_template);
int rest = at & 128;
int mandatory = at & 127;
- int nonrest = at >> 8;
+ ptrdiff_t nonrest = at >> 8;
eassert (mandatory <= nonrest);
if (nargs <= nonrest)
{
- int i;
+ ptrdiff_t i;
for (i = 0 ; i < nargs; i++, args++)
PUSH (*args);
if (nargs < mandatory)
@@ -528,7 +530,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
}
else if (rest)
{
- int i;
+ ptrdiff_t i;
for (i = 0 ; i < nonrest; i++, args++)
PUSH (*args);
PUSH (Flist (nargs - nonrest, args));
diff --git a/src/callint.c b/src/callint.c
index 29bb7ccc40..dc5e6a4c37 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -269,10 +269,9 @@ invoke it. If KEYS is omitted or nil, the return value of
/* If varies[i] > 0, the i'th argument shouldn't just have its value
in this call quoted in the command history. It should be
recorded as a call to the function named callint_argfuns[varies[i]]. */
- int *varies;
+ signed char *varies;
- register size_t i;
- size_t nargs;
+ ptrdiff_t i, nargs;
int foo;
char prompt1[100];
char *tem1;
@@ -465,9 +464,14 @@ invoke it. If KEYS is omitted or nil, the return value of
break;
}
+ if (min (MOST_POSITIVE_FIXNUM,
+ min (PTRDIFF_MAX, SIZE_MAX) / sizeof (Lisp_Object))
+ < nargs)
+ memory_full (SIZE_MAX);
+
args = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object));
visargs = (Lisp_Object *) alloca (nargs * sizeof (Lisp_Object));
- varies = (int *) alloca (nargs * sizeof (int));
+ varies = (signed char *) alloca (nargs);
for (i = 0; i < nargs; i++)
{
diff --git a/src/callproc.c b/src/callproc.c
index 7bb2ac0593..d6bad2a44e 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -184,7 +184,7 @@ and returns a numeric exit status or a signal description string.
If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object infile, buffer, current_dir, path;
volatile int display_p_volatile;
@@ -231,7 +231,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
/* Decide the coding-system for giving arguments. */
{
Lisp_Object val, *args2;
- size_t i;
+ ptrdiff_t i;
/* If arguments are supplied, we may have to encode them. */
if (nargs >= 5)
@@ -422,7 +422,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
(nargs > 4 ? nargs - 2 : 2) * sizeof *new_argv);
if (nargs > 4)
{
- register size_t i;
+ ptrdiff_t i;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
GCPRO5 (infile, buffer, current_dir, path, error_file);
@@ -716,7 +716,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
{
if (EQ (coding_systems, Qt))
{
- size_t i;
+ ptrdiff_t i;
SAFE_ALLOCA (args2, Lisp_Object *, (nargs + 1) * sizeof *args2);
args2[0] = Qcall_process;
@@ -944,7 +944,7 @@ and returns a numeric exit status or a signal description string.
If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
struct gcpro gcpro1;
Lisp_Object filename_string;
@@ -953,7 +953,7 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
/* Qt denotes we have not yet called Ffind_operation_coding_system. */
Lisp_Object coding_systems;
Lisp_Object val, *args2;
- size_t i;
+ ptrdiff_t i;
char *tempfile;
Lisp_Object tmpdir, pattern;
diff --git a/src/character.c b/src/character.c
index 70c0637804..7fc5d647ff 100644
--- a/src/character.c
+++ b/src/character.c
@@ -893,9 +893,9 @@ DEFUN ("string", Fstring, Sstring, 0, MANY, 0,
doc: /*
Concatenate all the argument characters and make the result a string.
usage: (string &rest CHARACTERS) */)
- (size_t n, Lisp_Object *args)
+ (ptrdiff_t n, Lisp_Object *args)
{
- size_t i;
+ ptrdiff_t i;
int c;
unsigned char *buf, *p;
Lisp_Object str;
@@ -919,9 +919,9 @@ usage: (string &rest CHARACTERS) */)
DEFUN ("unibyte-string", Funibyte_string, Sunibyte_string, 0, MANY, 0,
doc: /* Concatenate all the argument bytes and make the result a unibyte string.
usage: (unibyte-string &rest BYTES) */)
- (size_t n, Lisp_Object *args)
+ (ptrdiff_t n, Lisp_Object *args)
{
- size_t i;
+ ptrdiff_t i;
int c;
unsigned char *buf, *p;
Lisp_Object str;
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);
diff --git a/src/coding.c b/src/coding.c
index d914e0d641..04985ab3c7 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -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 ] */
diff --git a/src/data.c b/src/data.c
index a239a89c2d..cf01d38036 100644
--- a/src/data.c
+++ b/src/data.c
@@ -2503,18 +2503,18 @@ enum arithop
Amin
};
-static Lisp_Object float_arith_driver (double, size_t, enum arithop,
- size_t, Lisp_Object *);
+static Lisp_Object float_arith_driver (double, ptrdiff_t, enum arithop,
+ ptrdiff_t, Lisp_Object *);
static Lisp_Object
-arith_driver (enum arithop code, size_t nargs, register Lisp_Object *args)
+arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
{
register Lisp_Object val;
- register size_t argnum;
+ ptrdiff_t argnum;
register EMACS_INT accum = 0;
register EMACS_INT next;
int overflow = 0;
- size_t ok_args;
+ ptrdiff_t ok_args;
EMACS_INT ok_accum;
switch (SWITCH_ENUM_CAST (code))
@@ -2618,8 +2618,8 @@ arith_driver (enum arithop code, size_t nargs, register Lisp_Object *args)
#define isnan(x) ((x) != (x))
static Lisp_Object
-float_arith_driver (double accum, register size_t argnum, enum arithop code,
- size_t nargs, register Lisp_Object *args)
+float_arith_driver (double accum, ptrdiff_t argnum, enum arithop code,
+ ptrdiff_t nargs, Lisp_Object *args)
{
register Lisp_Object val;
double next;
@@ -2681,7 +2681,7 @@ float_arith_driver (double accum, register size_t argnum, enum arithop code,
DEFUN ("+", Fplus, Splus, 0, MANY, 0,
doc: /* Return sum of any number of arguments, which are numbers or markers.
usage: (+ &rest NUMBERS-OR-MARKERS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return arith_driver (Aadd, nargs, args);
}
@@ -2691,7 +2691,7 @@ DEFUN ("-", Fminus, Sminus, 0, MANY, 0,
With one arg, negates it. With more than one arg,
subtracts all but the first from the first.
usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return arith_driver (Asub, nargs, args);
}
@@ -2699,7 +2699,7 @@ usage: (- &optional NUMBER-OR-MARKER &rest MORE-NUMBERS-OR-MARKERS) */)
DEFUN ("*", Ftimes, Stimes, 0, MANY, 0,
doc: /* Return product of any number of arguments, which are numbers or markers.
usage: (* &rest NUMBERS-OR-MARKERS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return arith_driver (Amult, nargs, args);
}
@@ -2708,9 +2708,9 @@ DEFUN ("/", Fquo, Squo, 2, MANY, 0,
doc: /* Return first argument divided by all the remaining arguments.
The arguments must be numbers or markers.
usage: (/ DIVIDEND DIVISOR &rest DIVISORS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
- size_t argnum;
+ ptrdiff_t argnum;
for (argnum = 2; argnum < nargs; argnum++)
if (FLOATP (args[argnum]))
return float_arith_driver (0, 0, Adiv, nargs, args);
@@ -2792,7 +2792,7 @@ DEFUN ("max", Fmax, Smax, 1, MANY, 0,
doc: /* Return largest of all the arguments (which must be numbers or markers).
The value is always a number; markers are converted to numbers.
usage: (max NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return arith_driver (Amax, nargs, args);
}
@@ -2801,7 +2801,7 @@ DEFUN ("min", Fmin, Smin, 1, MANY, 0,
doc: /* Return smallest of all the arguments (which must be numbers or markers).
The value is always a number; markers are converted to numbers.
usage: (min NUMBER-OR-MARKER &rest NUMBERS-OR-MARKERS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return arith_driver (Amin, nargs, args);
}
@@ -2810,7 +2810,7 @@ DEFUN ("logand", Flogand, Slogand, 0, MANY, 0,
doc: /* Return bitwise-and of all the arguments.
Arguments may be integers, or markers converted to integers.
usage: (logand &rest INTS-OR-MARKERS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return arith_driver (Alogand, nargs, args);
}
@@ -2819,7 +2819,7 @@ DEFUN ("logior", Flogior, Slogior, 0, MANY, 0,
doc: /* Return bitwise-or of all the arguments.
Arguments may be integers, or markers converted to integers.
usage: (logior &rest INTS-OR-MARKERS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return arith_driver (Alogior, nargs, args);
}
@@ -2828,7 +2828,7 @@ DEFUN ("logxor", Flogxor, Slogxor, 0, MANY, 0,
doc: /* Return bitwise-exclusive-or of all the arguments.
Arguments may be integers, or markers converted to integers.
usage: (logxor &rest INTS-OR-MARKERS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return arith_driver (Alogxor, nargs, args);
}
diff --git a/src/dbusbind.c b/src/dbusbind.c
index d8d0c7c2ef..f662d5b38a 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1078,7 +1078,7 @@ object is returned instead of a list containing this single Lisp object.
=> "i686"
usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TIMEOUT &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object bus, service, path, interface, method;
Lisp_Object result;
@@ -1090,7 +1090,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
DBusError derror;
unsigned int dtype;
int timeout = -1;
- size_t i = 5;
+ ptrdiff_t i = 5;
char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
/* Check parameters. */
@@ -1143,7 +1143,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4,
SDATA (format2 ("%s", args[i], Qnil)),
SDATA (format2 ("%s", args[i+1], Qnil)));
++i;
@@ -1151,7 +1151,7 @@ usage: (dbus-call-method BUS SERVICE PATH INTERFACE METHOD &optional :timeout TI
else
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4,
SDATA (format2 ("%s", args[i], Qnil)));
}
@@ -1260,7 +1260,7 @@ Example:
-| i686
usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLER &optional :timeout TIMEOUT &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object bus, service, path, interface, method, handler;
Lisp_Object result;
@@ -1271,7 +1271,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
unsigned int dtype;
dbus_uint32_t serial;
int timeout = -1;
- size_t i = 6;
+ ptrdiff_t i = 6;
char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
/* Check parameters. */
@@ -1326,7 +1326,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4,
SDATA (format2 ("%s", args[i], Qnil)),
SDATA (format2 ("%s", args[i+1], Qnil)));
++i;
@@ -1334,7 +1334,7 @@ usage: (dbus-call-method-asynchronously BUS SERVICE PATH INTERFACE METHOD HANDLE
else
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i - 4),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4,
SDATA (format2 ("%s", args[i], Qnil)));
}
@@ -1386,7 +1386,7 @@ DEFUN ("dbus-method-return-internal", Fdbus_method_return_internal,
This is an internal function, it shall not be used outside dbus.el.
usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object bus, service;
struct gcpro gcpro1, gcpro2;
@@ -1395,7 +1395,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
DBusMessageIter iter;
dbus_uint32_t serial;
unsigned int ui_serial, dtype;
- size_t i;
+ ptrdiff_t i;
char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
/* Check parameters. */
@@ -1435,7 +1435,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2,
SDATA (format2 ("%s", args[i], Qnil)),
SDATA (format2 ("%s", args[i+1], Qnil)));
++i;
@@ -1443,7 +1443,7 @@ usage: (dbus-method-return-internal BUS SERIAL SERVICE &rest ARGS) */)
else
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2,
SDATA (format2 ("%s", args[i], Qnil)));
}
@@ -1475,7 +1475,7 @@ DEFUN ("dbus-method-error-internal", Fdbus_method_error_internal,
This is an internal function, it shall not be used outside dbus.el.
usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object bus, service;
struct gcpro gcpro1, gcpro2;
@@ -1484,7 +1484,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
DBusMessageIter iter;
dbus_uint32_t serial;
unsigned int ui_serial, dtype;
- size_t i;
+ ptrdiff_t i;
char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
/* Check parameters. */
@@ -1525,7 +1525,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-2),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 2,
SDATA (format2 ("%s", args[i], Qnil)),
SDATA (format2 ("%s", args[i+1], Qnil)));
++i;
@@ -1533,7 +1533,7 @@ usage: (dbus-method-error-internal BUS SERIAL SERVICE &rest ARGS) */)
else
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-2),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 2,
SDATA (format2 ("%s", args[i], Qnil)));
}
@@ -1588,7 +1588,7 @@ Example:
"org.gnu.Emacs.FileManager" "FileModified" "/home/albinus/.emacs")
usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object bus, service, path, interface, signal;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
@@ -1596,7 +1596,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
DBusMessage *dmessage;
DBusMessageIter iter;
unsigned int dtype;
- size_t i;
+ ptrdiff_t i;
char signature[DBUS_MAXIMUM_SIGNATURE_LENGTH];
/* Check parameters. */
@@ -1640,7 +1640,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
XD_DEBUG_VALID_LISP_OBJECT_P (args[i+1]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s %s", (unsigned long) (i-4),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s %s", i - 4,
SDATA (format2 ("%s", args[i], Qnil)),
SDATA (format2 ("%s", args[i+1], Qnil)));
++i;
@@ -1648,7 +1648,7 @@ usage: (dbus-send-signal BUS SERVICE PATH INTERFACE SIGNAL &rest ARGS) */)
else
{
XD_DEBUG_VALID_LISP_OBJECT_P (args[i]);
- XD_DEBUG_MESSAGE ("Parameter%lu %s", (unsigned long) (i-4),
+ XD_DEBUG_MESSAGE ("Parameter%"pD"d %s", i - 4,
SDATA (format2 ("%s", args[i], Qnil)));
}
@@ -1919,11 +1919,11 @@ Example:
=> :already-owner.
usage: (dbus-register-service BUS SERVICE &rest FLAGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object bus, service;
DBusConnection *connection;
- size_t i;
+ ptrdiff_t i;
unsigned int value;
unsigned int flags = 0;
int result;
@@ -2019,13 +2019,13 @@ INTERFACE, SIGNAL and HANDLER must not be nil. Example:
`dbus-unregister-object' for removing the registration.
usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object bus, service, path, interface, signal, handler;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
Lisp_Object uname, key, key1, value;
DBusConnection *connection;
- size_t i;
+ ptrdiff_t i;
char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
DBusError derror;
@@ -2095,7 +2095,7 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG
if (!NILP (args[i]))
{
CHECK_STRING (args[i]);
- sprintf (x, ",arg%lu='%s'", (unsigned long) (i-6),
+ sprintf (x, ",arg%"pD"d='%s'", i - 6,
SDATA (args[i]));
strcat (rule, x);
}
diff --git a/src/editfns.c b/src/editfns.c
index 12e82c428a..9678d4da6a 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -96,7 +96,7 @@ static void general_insert_function (void (*) (const char *, EMACS_INT),
void (*) (Lisp_Object, EMACS_INT,
EMACS_INT, EMACS_INT,
EMACS_INT, int),
- int, size_t, Lisp_Object *);
+ int, ptrdiff_t, Lisp_Object *);
static Lisp_Object subst_char_in_region_unwind (Lisp_Object);
static Lisp_Object subst_char_in_region_unwind_1 (Lisp_Object);
static void transpose_markers (EMACS_INT, EMACS_INT, EMACS_INT, EMACS_INT,
@@ -1858,7 +1858,7 @@ Years before 1970 are not guaranteed to work. On some systems,
year values as low as 1901 do work.
usage: (encode-time SECOND MINUTE HOUR DAY MONTH YEAR &optional ZONE) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
time_t value;
struct tm tm;
@@ -2194,9 +2194,9 @@ general_insert_function (void (*insert_func)
void (*insert_from_string_func)
(Lisp_Object, EMACS_INT, EMACS_INT,
EMACS_INT, EMACS_INT, int),
- int inherit, size_t nargs, Lisp_Object *args)
+ int inherit, ptrdiff_t nargs, Lisp_Object *args)
{
- register size_t argnum;
+ ptrdiff_t argnum;
register Lisp_Object val;
for (argnum = 0; argnum < nargs; argnum++)
@@ -2258,7 +2258,7 @@ buffer; to accomplish this, apply `string-as-multibyte' to the string
and insert the result.
usage: (insert &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
general_insert_function (insert, insert_from_string, 0, nargs, args);
return Qnil;
@@ -2277,7 +2277,7 @@ If the current buffer is unibyte, multibyte strings are converted
to unibyte for insertion.
usage: (insert-and-inherit &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
general_insert_function (insert_and_inherit, insert_from_string, 1,
nargs, args);
@@ -2294,7 +2294,7 @@ If the current buffer is unibyte, multibyte strings are converted
to unibyte for insertion.
usage: (insert-before-markers &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
general_insert_function (insert_before_markers,
insert_from_string_before_markers, 0,
@@ -2313,7 +2313,7 @@ If the current buffer is unibyte, multibyte strings are converted
to unibyte for insertion.
usage: (insert-before-markers-and-inherit &rest ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
general_insert_function (insert_before_markers_and_inherit,
insert_from_string_before_markers, 1,
@@ -3386,7 +3386,7 @@ any existing message; this lets the minibuffer contents show. See
also `current-message'.
usage: (message FORMAT-STRING &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
if (NILP (args[0])
|| (STRINGP (args[0])
@@ -3414,7 +3414,7 @@ If the first argument is nil or the empty string, clear any existing
message; let the minibuffer contents show.
usage: (message-box FORMAT-STRING &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
if (NILP (args[0]))
{
@@ -3471,7 +3471,7 @@ If the first argument is nil or the empty string, clear any existing
message; let the minibuffer contents show.
usage: (message-or-box FORMAT-STRING &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
#ifdef HAVE_MENUS
if ((NILP (last_nonmenu_event) || CONSP (last_nonmenu_event))
@@ -3495,11 +3495,11 @@ First argument is the string to copy.
Remaining arguments form a sequence of PROPERTY VALUE pairs for text
properties to add to the result.
usage: (propertize STRING &rest PROPERTIES) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object properties, string;
struct gcpro gcpro1, gcpro2;
- size_t i;
+ ptrdiff_t i;
/* Number of args must be odd. */
if ((nargs & 1) == 0)
@@ -3584,9 +3584,9 @@ decimal point itself is omitted. For %s and %S, the precision
specifier truncates the string to the given width.
usage: (format STRING &rest OBJECTS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
- EMACS_INT n; /* The number of the next arg to substitute */
+ ptrdiff_t n; /* The number of the next arg to substitute */
char initial_buffer[4000];
char *buf = initial_buffer;
EMACS_INT bufsize = sizeof initial_buffer;
@@ -3635,7 +3635,7 @@ usage: (format STRING &rest OBJECTS) */)
/* Allocate the info and discarded tables. */
{
- EMACS_INT i;
+ ptrdiff_t i;
if ((SIZE_MAX - formatlen) / sizeof (struct info) <= nargs)
memory_full (SIZE_MAX);
SAFE_ALLOCA (info, struct info *, (nargs + 1) * sizeof *info + formatlen);
@@ -3674,7 +3674,7 @@ usage: (format STRING &rest OBJECTS) */)
while (format != end)
{
/* The values of N and FORMAT when the loop body is entered. */
- EMACS_INT n0 = n;
+ ptrdiff_t n0 = n;
char *format0 = format;
/* Bytes needed to represent the output of this conversion. */
diff --git a/src/eval.c b/src/eval.c
index a9703fc0aa..65cd87cd8e 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -139,7 +139,7 @@ Lisp_Object Vsignaling_function;
int handling_signal;
-static Lisp_Object funcall_lambda (Lisp_Object, size_t, Lisp_Object *);
+static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *);
static void unwind_to_catch (struct catchtag *, Lisp_Object) NO_RETURN;
static int interactive_p (int);
static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args);
@@ -1052,7 +1052,7 @@ usage: (let VARLIST BODY...) */)
Lisp_Object *temps, tem, lexenv;
register Lisp_Object elt, varlist;
int count = SPECPDL_INDEX ();
- register size_t argnum;
+ ptrdiff_t argnum;
struct gcpro gcpro1, gcpro2;
USE_SAFE_ALLOCA;
@@ -1608,8 +1608,8 @@ internal_condition_case_2 (Lisp_Object (*bfun) (Lisp_Object, Lisp_Object),
and ARGS as second argument. */
Lisp_Object
-internal_condition_case_n (Lisp_Object (*bfun) (size_t, Lisp_Object *),
- size_t nargs,
+internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *),
+ ptrdiff_t nargs,
Lisp_Object *args,
Lisp_Object handlers,
Lisp_Object (*hfun) (Lisp_Object))
@@ -2336,7 +2336,7 @@ eval_sub (Lisp_Object form)
{
/* Pass a vector of evaluated arguments. */
Lisp_Object *vals;
- register size_t argnum = 0;
+ ptrdiff_t argnum = 0;
USE_SAFE_ALLOCA;
SAFE_ALLOCA_LISP (vals, XINT (numargs));
@@ -2466,9 +2466,9 @@ DEFUN ("apply", Fapply, Sapply, 2, MANY, 0,
Then return the value FUNCTION returns.
Thus, (apply '+ 1 2 '(3 4)) returns 10.
usage: (apply FUNCTION &rest ARGUMENTS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
- register size_t i, numargs;
+ ptrdiff_t i, numargs;
register Lisp_Object spread_arg;
register Lisp_Object *funcall_args;
Lisp_Object fun, retval;
@@ -2550,7 +2550,7 @@ usage: (apply FUNCTION &rest ARGUMENTS) */)
/* Run hook variables in various ways. */
static Lisp_Object
-funcall_nil (size_t nargs, Lisp_Object *args)
+funcall_nil (ptrdiff_t nargs, Lisp_Object *args)
{
Ffuncall (nargs, args);
return Qnil;
@@ -2571,10 +2571,10 @@ hook; they should use `run-mode-hooks' instead.
Do not use `make-local-variable' to make a hook variable buffer-local.
Instead, use `add-hook' and specify t for the LOCAL argument.
usage: (run-hooks &rest HOOKS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object hook[1];
- register size_t i;
+ ptrdiff_t i;
for (i = 0; i < nargs; i++)
{
@@ -2600,7 +2600,7 @@ as that may change.
Do not use `make-local-variable' to make a hook variable buffer-local.
Instead, use `add-hook' and specify t for the LOCAL argument.
usage: (run-hook-with-args HOOK &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return run_hook_with_args (nargs, args, funcall_nil);
}
@@ -2620,13 +2620,13 @@ However, if they all return nil, we return nil.
Do not use `make-local-variable' to make a hook variable buffer-local.
Instead, use `add-hook' and specify t for the LOCAL argument.
usage: (run-hook-with-args-until-success HOOK &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return run_hook_with_args (nargs, args, Ffuncall);
}
static Lisp_Object
-funcall_not (size_t nargs, Lisp_Object *args)
+funcall_not (ptrdiff_t nargs, Lisp_Object *args)
{
return NILP (Ffuncall (nargs, args)) ? Qt : Qnil;
}
@@ -2645,13 +2645,13 @@ Then we return nil. However, if they all return non-nil, we return non-nil.
Do not use `make-local-variable' to make a hook variable buffer-local.
Instead, use `add-hook' and specify t for the LOCAL argument.
usage: (run-hook-with-args-until-failure HOOK &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return NILP (run_hook_with_args (nargs, args, funcall_not)) ? Qt : Qnil;
}
static Lisp_Object
-run_hook_wrapped_funcall (size_t nargs, Lisp_Object *args)
+run_hook_wrapped_funcall (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object tmp = args[0], ret;
args[0] = args[1];
@@ -2669,7 +2669,7 @@ it calls WRAP-FUNCTION with arguments FUN and ARGS.
As soon as a call to WRAP-FUNCTION returns non-nil, `run-hook-wrapped'
aborts and returns that value.
usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return run_hook_with_args (nargs, args, run_hook_wrapped_funcall);
}
@@ -2682,8 +2682,8 @@ usage: (run-hook-wrapped HOOK WRAP-FUNCTION &rest ARGS) */)
except that it isn't necessary to gcpro ARGS[0]. */
Lisp_Object
-run_hook_with_args (size_t nargs, Lisp_Object *args,
- Lisp_Object (*funcall) (size_t nargs, Lisp_Object *args))
+run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args,
+ Lisp_Object (*funcall) (ptrdiff_t nargs, Lisp_Object *args))
{
Lisp_Object sym, val, ret = Qnil;
struct gcpro gcpro1, gcpro2, gcpro3;
@@ -2956,16 +2956,16 @@ DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0,
Return the value that function returns.
Thus, (funcall 'cons 'x 'y) returns (x . y).
usage: (funcall FUNCTION &rest ARGUMENTS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object fun, original_fun;
Lisp_Object funcar;
- size_t numargs = nargs - 1;
+ ptrdiff_t numargs = nargs - 1;
Lisp_Object lisp_numargs;
Lisp_Object val;
struct backtrace backtrace;
register Lisp_Object *internal_args;
- register size_t i;
+ ptrdiff_t i;
QUIT;
if ((consing_since_gc > gc_cons_threshold
@@ -3119,14 +3119,13 @@ static Lisp_Object
apply_lambda (Lisp_Object fun, Lisp_Object args)
{
Lisp_Object args_left;
- size_t numargs;
+ ptrdiff_t i, numargs;
register Lisp_Object *arg_vector;
struct gcpro gcpro1, gcpro2, gcpro3;
- register size_t i;
register Lisp_Object tem;
USE_SAFE_ALLOCA;
- numargs = XINT (Flength (args));
+ numargs = XFASTINT (Flength (args));
SAFE_ALLOCA_LISP (arg_vector, numargs);
args_left = args;
@@ -3162,12 +3161,12 @@ apply_lambda (Lisp_Object fun, Lisp_Object args)
FUN must be either a lambda-expression or a compiled-code object. */
static Lisp_Object
-funcall_lambda (Lisp_Object fun, size_t nargs,
+funcall_lambda (Lisp_Object fun, ptrdiff_t nargs,
register Lisp_Object *arg_vector)
{
Lisp_Object val, syms_left, next, lexenv;
int count = SPECPDL_INDEX ();
- size_t i;
+ ptrdiff_t i;
int optional, rest;
if (CONSP (fun))
@@ -3584,7 +3583,7 @@ Output stream used is value of `standard-output'. */)
}
else
{
- size_t i;
+ ptrdiff_t i;
for (i = 0; i < backlist->nargs; i++)
{
if (i) write_string (" ", -1);
@@ -3644,7 +3643,7 @@ void
mark_backtrace (void)
{
register struct backtrace *backlist;
- register size_t i;
+ ptrdiff_t i;
for (backlist = backtrace_list; backlist; backlist = backlist->next)
{
diff --git a/src/fns.c b/src/fns.c
index b42e5f3b7c..0e98a8d342 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -344,7 +344,7 @@ Symbols are also allowed; their print names are used instead. */)
return i1 < SCHARS (s2) ? Qt : Qnil;
}
-static Lisp_Object concat (size_t nargs, Lisp_Object *args,
+static Lisp_Object concat (ptrdiff_t nargs, Lisp_Object *args,
enum Lisp_Type target_type, int last_special);
/* ARGSUSED */
@@ -374,7 +374,7 @@ The result is a list whose elements are the elements of all the arguments.
Each argument may be a list, vector or string.
The last argument is not copied, just used as the tail of the new list.
usage: (append &rest SEQUENCES) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return concat (nargs, args, Lisp_Cons, 1);
}
@@ -384,7 +384,7 @@ DEFUN ("concat", Fconcat, Sconcat, 0, MANY, 0,
The result is a string whose elements are the elements of all the arguments.
Each argument may be a string or a list or vector of characters (integers).
usage: (concat &rest SEQUENCES) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return concat (nargs, args, Lisp_String, 0);
}
@@ -394,7 +394,7 @@ DEFUN ("vconcat", Fvconcat, Svconcat, 0, MANY, 0,
The result is a vector whose elements are the elements of all the arguments.
Each argument may be a list, vector or string.
usage: (vconcat &rest SEQUENCES) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
return concat (nargs, args, Lisp_Vectorlike, 0);
}
@@ -436,13 +436,13 @@ with the original. */)
a string and has text properties to be copied. */
struct textprop_rec
{
- int argnum; /* refer to ARGS (arguments of `concat') */
+ ptrdiff_t argnum; /* refer to ARGS (arguments of `concat') */
EMACS_INT from; /* refer to ARGS[argnum] (argument string) */
EMACS_INT to; /* refer to VAL (the target string) */
};
static Lisp_Object
-concat (size_t nargs, Lisp_Object *args,
+concat (ptrdiff_t nargs, Lisp_Object *args,
enum Lisp_Type target_type, int last_special)
{
Lisp_Object val;
@@ -452,7 +452,7 @@ concat (size_t nargs, Lisp_Object *args,
EMACS_INT toindex_byte = 0;
register EMACS_INT result_len;
register EMACS_INT result_len_byte;
- register size_t argnum;
+ ptrdiff_t argnum;
Lisp_Object last_tail;
Lisp_Object prev;
int some_multibyte;
@@ -463,7 +463,7 @@ concat (size_t nargs, Lisp_Object *args,
here, and copy the text properties after the concatenation. */
struct textprop_rec *textprops = NULL;
/* Number of elements in textprops. */
- int num_textprops = 0;
+ ptrdiff_t num_textprops = 0;
USE_SAFE_ALLOCA;
tail = Qnil;
@@ -2217,9 +2217,9 @@ DEFUN ("nconc", Fnconc, Snconc, 0, MANY, 0,
doc: /* Concatenate any number of lists by altering them.
Only the last argument is not altered, and need not be a list.
usage: (nconc &rest LISTS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
- register size_t argnum;
+ ptrdiff_t argnum;
register Lisp_Object tail, tem, val;
val = tail = Qnil;
@@ -2342,9 +2342,8 @@ SEQUENCE may be a list, a vector, a bool-vector, or a string. */)
{
Lisp_Object len;
register EMACS_INT leni;
- int nargs;
+ ptrdiff_t i, nargs;
register Lisp_Object *args;
- register EMACS_INT i;
struct gcpro gcpro1;
Lisp_Object ret;
USE_SAFE_ALLOCA;
@@ -2748,7 +2747,7 @@ DEFUN ("widget-apply", Fwidget_apply, Swidget_apply, 2, MANY, 0,
doc: /* Apply the value of WIDGET's PROPERTY to the widget itself.
ARGS are passed as extra arguments to the function.
usage: (widget-apply WIDGET PROPERTY &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
/* This function can GC. */
Lisp_Object newargs[3];
@@ -3353,7 +3352,7 @@ static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
/* Function prototypes. */
static struct Lisp_Hash_Table *check_hash_table (Lisp_Object);
-static size_t get_key_arg (Lisp_Object, size_t, Lisp_Object *, char *);
+static ptrdiff_t get_key_arg (Lisp_Object, ptrdiff_t, Lisp_Object *, char *);
static void maybe_resize_hash_table (struct Lisp_Hash_Table *);
static int sweep_weak_table (struct Lisp_Hash_Table *, int);
@@ -3396,10 +3395,10 @@ next_almost_prime (EMACS_INT n)
0. This function is used to extract a keyword/argument pair from
a DEFUN parameter list. */
-static size_t
-get_key_arg (Lisp_Object key, size_t nargs, Lisp_Object *args, char *used)
+static ptrdiff_t
+get_key_arg (Lisp_Object key, ptrdiff_t nargs, Lisp_Object *args, char *used)
{
- size_t i;
+ ptrdiff_t i;
for (i = 1; i < nargs; i++)
if (!used[i - 1] && EQ (args[i - 1], key))
@@ -4297,12 +4296,12 @@ WEAK. WEAK t is equivalent to `key-and-value'. Default value of WEAK
is nil.
usage: (make-hash-table &rest KEYWORD-ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object test, size, rehash_size, rehash_threshold, weak;
Lisp_Object user_test, user_hash;
char *used;
- size_t i;
+ ptrdiff_t i;
/* The vector `used' is used to keep track of arguments that
have been consumed. */
diff --git a/src/font.c b/src/font.c
index 326c9d80e4..ecb61ab6a5 100644
--- a/src/font.c
+++ b/src/font.c
@@ -3829,10 +3829,10 @@ be an OpenType font whose GPOS table of `thai' script's default
language system must contain `mark' feature.
usage: (font-spec ARGS...) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object spec = font_make_spec ();
- size_t i;
+ ptrdiff_t i;
for (i = 0; i < nargs; i += 2)
{
diff --git a/src/frame.c b/src/frame.c
index 34474417ef..27a31fac3e 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -2807,7 +2807,7 @@ x_set_frame_parameters (FRAME_PTR f, Lisp_Object alist)
/* Record in these vectors all the parms specified. */
Lisp_Object *parms;
Lisp_Object *values;
- size_t i, p;
+ ptrdiff_t i, p;
int left_no_change = 0, top_no_change = 0;
int icon_left_no_change = 0, icon_top_no_change = 0;
int size_changed = 0;
diff --git a/src/keyboard.c b/src/keyboard.c
index 20ad7d0ce9..e7a0598e83 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1901,7 +1901,7 @@ safe_run_hooks_error (Lisp_Object error_data)
}
static Lisp_Object
-safe_run_hook_funcall (size_t nargs, Lisp_Object *args)
+safe_run_hook_funcall (ptrdiff_t nargs, Lisp_Object *args)
{
eassert (nargs == 1);
if (CONSP (Vinhibit_quit))
diff --git a/src/lisp.h b/src/lisp.h
index 3f6a84f8fa..83534e5543 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -1039,7 +1039,7 @@ struct Lisp_Subr
Lisp_Object (*a7) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
Lisp_Object (*a8) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);
Lisp_Object (*aUNEVALLED) (Lisp_Object args);
- Lisp_Object (*aMANY) (size_t, Lisp_Object *);
+ Lisp_Object (*aMANY) (ptrdiff_t, Lisp_Object *);
} function;
short min_args, max_args;
const char *symbol_name;
@@ -1896,7 +1896,7 @@ typedef struct {
/* Note that the weird token-substitution semantics of ANSI C makes
this work for MANY and UNEVALLED. */
-#define DEFUN_ARGS_MANY (size_t, Lisp_Object *)
+#define DEFUN_ARGS_MANY (ptrdiff_t, Lisp_Object *)
#define DEFUN_ARGS_UNEVALLED (Lisp_Object)
#define DEFUN_ARGS_0 (void)
#define DEFUN_ARGS_1 (Lisp_Object)
@@ -2161,7 +2161,7 @@ struct gcpro
volatile Lisp_Object *var;
/* Number of consecutive protected variables. */
- size_t nvars;
+ ptrdiff_t nvars;
#ifdef DEBUG_GCPRO
int level;
@@ -2922,9 +2922,9 @@ EXFUN (Frun_hooks, MANY);
EXFUN (Frun_hook_with_args, MANY);
EXFUN (Frun_hook_with_args_until_failure, MANY);
extern void run_hook_with_args_2 (Lisp_Object, Lisp_Object, Lisp_Object);
-extern Lisp_Object run_hook_with_args (size_t nargs, Lisp_Object *args,
+extern Lisp_Object run_hook_with_args (ptrdiff_t nargs, Lisp_Object *args,
Lisp_Object (*funcall)
- (size_t nargs, Lisp_Object *args));
+ (ptrdiff_t nargs, Lisp_Object *args));
EXFUN (Fprogn, UNEVALLED);
EXFUN (Finteractive_p, 0);
EXFUN (Fthrow, 2) NO_RETURN;
@@ -2956,7 +2956,7 @@ extern Lisp_Object internal_lisp_condition_case (Lisp_Object, Lisp_Object, Lisp_
extern Lisp_Object internal_condition_case (Lisp_Object (*) (void), Lisp_Object, Lisp_Object (*) (Lisp_Object));
extern Lisp_Object internal_condition_case_1 (Lisp_Object (*) (Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object));
extern Lisp_Object internal_condition_case_2 (Lisp_Object (*) (Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object (*) (Lisp_Object));
-extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (size_t, Lisp_Object *), size_t, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object));
+extern Lisp_Object internal_condition_case_n (Lisp_Object (*) (ptrdiff_t, Lisp_Object *), ptrdiff_t, Lisp_Object *, Lisp_Object, Lisp_Object (*) (Lisp_Object));
extern void specbind (Lisp_Object, Lisp_Object);
extern void record_unwind_protect (Lisp_Object (*) (Lisp_Object), Lisp_Object);
extern Lisp_Object unbind_to (int, Lisp_Object);
@@ -2966,7 +2966,7 @@ extern void verror (const char *, va_list)
extern void do_autoload (Lisp_Object, Lisp_Object);
extern Lisp_Object un_autoload (Lisp_Object);
extern void init_eval_once (void);
-extern Lisp_Object safe_call (size_t, Lisp_Object *);
+extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object *);
extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object);
extern Lisp_Object safe_call2 (Lisp_Object, Lisp_Object, Lisp_Object);
extern void init_eval (void);
@@ -3348,7 +3348,7 @@ extern void mark_byte_stack (void);
#endif
extern void unmark_byte_stack (void);
extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object,
- Lisp_Object, int, Lisp_Object *);
+ Lisp_Object, ptrdiff_t, Lisp_Object *);
/* Defined in macros.c */
extern Lisp_Object Qexecute_kbd_macro;
diff --git a/src/process.c b/src/process.c
index 9ff7dd198d..5a26bf4314 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1272,11 +1272,11 @@ the command through a shell and redirect one of them using the shell
syntax.
usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
- (size_t nargs, register Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object buffer, name, program, proc, current_dir, tem;
register unsigned char **new_argv;
- register size_t i;
+ ptrdiff_t i;
int count = SPECPDL_INDEX ();
buffer = args[1];
@@ -2436,7 +2436,7 @@ Examples:
\(serial-process-configure :port "\\\\.\\COM13" :bytesize 7)
usage: (serial-process-configure &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
struct Lisp_Process *p;
Lisp_Object contact = Qnil;
@@ -2554,7 +2554,7 @@ Examples:
\(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil)
usage: (make-serial-process &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
int fd = -1;
Lisp_Object proc, contact, port;
@@ -2832,7 +2832,7 @@ The original argument list, modified with the actual connection
information, is available via the `process-contact' function.
usage: (make-network-process &rest ARGS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object proc;
Lisp_Object contact;
@@ -3148,7 +3148,7 @@ usage: (make-network-process &rest ARGS) */)
for (lres = res; lres; lres = lres->ai_next)
{
- size_t optn;
+ ptrdiff_t optn;
int optbits;
#ifdef WINDOWSNT
diff --git a/src/xdisp.c b/src/xdisp.c
index ad99fd41ff..5a0b0060fa 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2138,7 +2138,7 @@ safe_eval_handler (Lisp_Object arg)
redisplay during the evaluation. */
Lisp_Object
-safe_call (size_t nargs, Lisp_Object *args)
+safe_call (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object val;
@@ -16571,7 +16571,7 @@ With ARG, turn tracing on if and only if ARG is positive. */)
DEFUN ("trace-to-stderr", Ftrace_to_stderr, Strace_to_stderr, 1, MANY, "",
doc: /* Like `format', but print result to stderr.
usage: (trace-to-stderr STRING &rest OBJECTS) */)
- (size_t nargs, Lisp_Object *args)
+ (ptrdiff_t nargs, Lisp_Object *args)
{
Lisp_Object s = Fformat (nargs, args);
fprintf (stderr, "%s", SDATA (s));