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/process.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/process.c')
| -rw-r--r-- | src/process.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/process.c b/src/process.c index 9ff7dd198dd..5a26bf43146 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 | |||
| 1272 | syntax. | 1272 | syntax. |
| 1273 | 1273 | ||
| 1274 | usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) | 1274 | usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */) |
| 1275 | (size_t nargs, register Lisp_Object *args) | 1275 | (ptrdiff_t nargs, Lisp_Object *args) |
| 1276 | { | 1276 | { |
| 1277 | Lisp_Object buffer, name, program, proc, current_dir, tem; | 1277 | Lisp_Object buffer, name, program, proc, current_dir, tem; |
| 1278 | register unsigned char **new_argv; | 1278 | register unsigned char **new_argv; |
| 1279 | register size_t i; | 1279 | ptrdiff_t i; |
| 1280 | int count = SPECPDL_INDEX (); | 1280 | int count = SPECPDL_INDEX (); |
| 1281 | 1281 | ||
| 1282 | buffer = args[1]; | 1282 | buffer = args[1]; |
| @@ -2436,7 +2436,7 @@ Examples: | |||
| 2436 | \(serial-process-configure :port "\\\\.\\COM13" :bytesize 7) | 2436 | \(serial-process-configure :port "\\\\.\\COM13" :bytesize 7) |
| 2437 | 2437 | ||
| 2438 | usage: (serial-process-configure &rest ARGS) */) | 2438 | usage: (serial-process-configure &rest ARGS) */) |
| 2439 | (size_t nargs, Lisp_Object *args) | 2439 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2440 | { | 2440 | { |
| 2441 | struct Lisp_Process *p; | 2441 | struct Lisp_Process *p; |
| 2442 | Lisp_Object contact = Qnil; | 2442 | Lisp_Object contact = Qnil; |
| @@ -2554,7 +2554,7 @@ Examples: | |||
| 2554 | \(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil) | 2554 | \(make-serial-process :port "/dev/tty.BlueConsole-SPP-1" :speed nil) |
| 2555 | 2555 | ||
| 2556 | usage: (make-serial-process &rest ARGS) */) | 2556 | usage: (make-serial-process &rest ARGS) */) |
| 2557 | (size_t nargs, Lisp_Object *args) | 2557 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2558 | { | 2558 | { |
| 2559 | int fd = -1; | 2559 | int fd = -1; |
| 2560 | Lisp_Object proc, contact, port; | 2560 | Lisp_Object proc, contact, port; |
| @@ -2832,7 +2832,7 @@ The original argument list, modified with the actual connection | |||
| 2832 | information, is available via the `process-contact' function. | 2832 | information, is available via the `process-contact' function. |
| 2833 | 2833 | ||
| 2834 | usage: (make-network-process &rest ARGS) */) | 2834 | usage: (make-network-process &rest ARGS) */) |
| 2835 | (size_t nargs, Lisp_Object *args) | 2835 | (ptrdiff_t nargs, Lisp_Object *args) |
| 2836 | { | 2836 | { |
| 2837 | Lisp_Object proc; | 2837 | Lisp_Object proc; |
| 2838 | Lisp_Object contact; | 2838 | Lisp_Object contact; |
| @@ -3148,7 +3148,7 @@ usage: (make-network-process &rest ARGS) */) | |||
| 3148 | 3148 | ||
| 3149 | for (lres = res; lres; lres = lres->ai_next) | 3149 | for (lres = res; lres; lres = lres->ai_next) |
| 3150 | { | 3150 | { |
| 3151 | size_t optn; | 3151 | ptrdiff_t optn; |
| 3152 | int optbits; | 3152 | int optbits; |
| 3153 | 3153 | ||
| 3154 | #ifdef WINDOWSNT | 3154 | #ifdef WINDOWSNT |