aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2012-08-24 20:11:12 -0700
committerPaul Eggert2012-08-24 20:11:12 -0700
commit2f221583cf4a4b412c16260d148b59931b12455a (patch)
tree8525d0d67da67946b809c470aa2c4387bf10697a /src
parentaa0ecd9449986eacd07989f599739902dcaacc49 (diff)
downloademacs-2f221583cf4a4b412c16260d148b59931b12455a.tar.gz
emacs-2f221583cf4a4b412c16260d148b59931b12455a.zip
* bytecode.c, callint.c, callproc.c: Use bool for boolean.
* bytecode.c (exec_byte_code): * callint.c (check_mark, Fcall_interactively): * callproc.c (Fcall_process, add_env, child_setup, getenv_internal_1) (getenv_internal, sync_process_alive, call_process_exited): * lisp.h (USE_SAFE_ALLOCA): Use bool for booleans, instead of int. * lisp.h, process.h: Adjust prototypes to match above changes. * callint.c (Fcall_interactively): Don't assume the mark's offset fits in 'int'.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog13
-rw-r--r--src/bytecode.c2
-rw-r--r--src/callint.c16
-rw-r--r--src/callproc.c36
-rw-r--r--src/lisp.h4
-rw-r--r--src/process.h2
6 files changed, 43 insertions, 30 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index feed9f8233e..95b9a57f24b 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,16 @@
12012-08-25 Paul Eggert <eggert@cs.ucla.edu>
2
3 * bytecode.c, callint.c, callproc.c: Use bool for boolean.
4 * bytecode.c (exec_byte_code):
5 * callint.c (check_mark, Fcall_interactively):
6 * callproc.c (Fcall_process, add_env, child_setup, getenv_internal_1)
7 (getenv_internal, sync_process_alive, call_process_exited):
8 * lisp.h (USE_SAFE_ALLOCA):
9 Use bool for booleans, instead of int.
10 * lisp.h, process.h: Adjust prototypes to match above changes.
11 * callint.c (Fcall_interactively): Don't assume the mark's
12 offset fits in 'int'.
13
12012-08-24 Paul Eggert <eggert@cs.ucla.edu> 142012-08-24 Paul Eggert <eggert@cs.ucla.edu>
2 15
3 * buffer.c, buffer.h: Use bool for boolean. 16 * buffer.c, buffer.h: Use bool for boolean.
diff --git a/src/bytecode.c b/src/bytecode.c
index 5ac8b4fa2bd..753f149ae01 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -553,7 +553,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
553 if (INTEGERP (args_template)) 553 if (INTEGERP (args_template))
554 { 554 {
555 ptrdiff_t at = XINT (args_template); 555 ptrdiff_t at = XINT (args_template);
556 int rest = at & 128; 556 bool rest = (at & 128) != 0;
557 int mandatory = at & 127; 557 int mandatory = at & 127;
558 ptrdiff_t nonrest = at >> 8; 558 ptrdiff_t nonrest = at >> 8;
559 eassert (mandatory <= nonrest); 559 eassert (mandatory <= nonrest);
diff --git a/src/callint.c b/src/callint.c
index 36a59e812f2..b11545ddea2 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -150,7 +150,7 @@ static const char *callint_argfuns[]
150 = {"", "point", "mark", "region-beginning", "region-end"}; 150 = {"", "point", "mark", "region-beginning", "region-end"};
151 151
152static void 152static void
153check_mark (int for_region) 153check_mark (bool for_region)
154{ 154{
155 Lisp_Object tem; 155 Lisp_Object tem;
156 tem = Fmarker_buffer (BVAR (current_buffer, mark)); 156 tem = Fmarker_buffer (BVAR (current_buffer, mark));
@@ -273,11 +273,11 @@ invoke it. If KEYS is omitted or nil, the return value of
273 signed char *varies; 273 signed char *varies;
274 274
275 ptrdiff_t i, nargs; 275 ptrdiff_t i, nargs;
276 int foo; 276 ptrdiff_t mark;
277 int arg_from_tty = 0; 277 bool arg_from_tty = 0;
278 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; 278 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
279 ptrdiff_t key_count; 279 ptrdiff_t key_count;
280 int record_then_fail = 0; 280 bool record_then_fail = 0;
281 281
282 Lisp_Object save_this_command, save_last_command; 282 Lisp_Object save_this_command, save_last_command;
283 Lisp_Object save_this_original_command, save_real_this_command; 283 Lisp_Object save_this_original_command, save_real_this_command;
@@ -685,7 +685,7 @@ invoke it. If KEYS is omitted or nil, the return value of
685 goto have_prefix_arg; 685 goto have_prefix_arg;
686 case 'n': /* Read number from minibuffer. */ 686 case 'n': /* Read number from minibuffer. */
687 { 687 {
688 int first = 1; 688 bool first = 1;
689 do 689 do
690 { 690 {
691 Lisp_Object str; 691 Lisp_Object str;
@@ -726,11 +726,11 @@ invoke it. If KEYS is omitted or nil, the return value of
726 check_mark (1); 726 check_mark (1);
727 set_marker_both (point_marker, Qnil, PT, PT_BYTE); 727 set_marker_both (point_marker, Qnil, PT, PT_BYTE);
728 /* visargs[i+1] = Qnil; */ 728 /* visargs[i+1] = Qnil; */
729 foo = marker_position (BVAR (current_buffer, mark)); 729 mark = marker_position (BVAR (current_buffer, mark));
730 /* visargs[i] = Qnil; */ 730 /* visargs[i] = Qnil; */
731 args[i] = PT < foo ? point_marker : BVAR (current_buffer, mark); 731 args[i] = PT < mark ? point_marker : BVAR (current_buffer, mark);
732 varies[i] = 3; 732 varies[i] = 3;
733 args[++i] = PT > foo ? point_marker : BVAR (current_buffer, mark); 733 args[++i] = PT > mark ? point_marker : BVAR (current_buffer, mark);
734 varies[i] = 4; 734 varies[i] = 4;
735 break; 735 break;
736 736
diff --git a/src/callproc.c b/src/callproc.c
index 4bf1da04e1a..2e9a8950700 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -77,7 +77,7 @@ static Lisp_Object Vtemp_file_name_pattern;
77 77
78/* True if we are about to fork off a synchronous process or if we 78/* True if we are about to fork off a synchronous process or if we
79 are waiting for it. */ 79 are waiting for it. */
80int synch_process_alive; 80bool synch_process_alive;
81 81
82/* Nonzero => this is a string explaining death of synchronous subprocess. */ 82/* Nonzero => this is a string explaining death of synchronous subprocess. */
83const char *synch_process_death; 83const char *synch_process_death;
@@ -94,8 +94,8 @@ int synch_process_retcode;
94 On MSDOS, delete the temporary file on any kind of termination. 94 On MSDOS, delete the temporary file on any kind of termination.
95 On Unix, kill the process and any children on termination by signal. */ 95 On Unix, kill the process and any children on termination by signal. */
96 96
97/* Nonzero if this is termination due to exit. */ 97/* True if this is termination due to exit. */
98static int call_process_exited; 98static bool call_process_exited;
99 99
100static Lisp_Object 100static Lisp_Object
101call_process_kill (Lisp_Object fdpid) 101call_process_kill (Lisp_Object fdpid)
@@ -190,7 +190,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
190 (ptrdiff_t nargs, Lisp_Object *args) 190 (ptrdiff_t nargs, Lisp_Object *args)
191{ 191{
192 Lisp_Object infile, buffer, current_dir, path, cleanup_info_tail; 192 Lisp_Object infile, buffer, current_dir, path, cleanup_info_tail;
193 int display_p; 193 bool display_p;
194 int fd[2]; 194 int fd[2];
195 int filefd; 195 int filefd;
196#define CALLPROC_BUFFER_SIZE_MIN (16 * 1024) 196#define CALLPROC_BUFFER_SIZE_MIN (16 * 1024)
@@ -217,7 +217,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
217 struct coding_system argument_coding; /* coding-system of arguments */ 217 struct coding_system argument_coding; /* coding-system of arguments */
218 /* Set to the return value of Ffind_operation_coding_system. */ 218 /* Set to the return value of Ffind_operation_coding_system. */
219 Lisp_Object coding_systems; 219 Lisp_Object coding_systems;
220 int output_to_buffer = 1; 220 bool output_to_buffer = 1;
221 221
222 /* Qt denotes that Ffind_operation_coding_system is not yet called. */ 222 /* Qt denotes that Ffind_operation_coding_system is not yet called. */
223 coding_systems = Qt; 223 coding_systems = Qt;
@@ -241,7 +241,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
241 /* If arguments are supplied, we may have to encode them. */ 241 /* If arguments are supplied, we may have to encode them. */
242 if (nargs >= 5) 242 if (nargs >= 5)
243 { 243 {
244 int must_encode = 0; 244 bool must_encode = 0;
245 Lisp_Object coding_attrs; 245 Lisp_Object coding_attrs;
246 246
247 for (i = 4; i < nargs; i++) 247 for (i = 4; i < nargs; i++)
@@ -610,12 +610,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
610 Lisp_Object volatile buffer_volatile = buffer; 610 Lisp_Object volatile buffer_volatile = buffer;
611 Lisp_Object volatile coding_systems_volatile = coding_systems; 611 Lisp_Object volatile coding_systems_volatile = coding_systems;
612 Lisp_Object volatile current_dir_volatile = current_dir; 612 Lisp_Object volatile current_dir_volatile = current_dir;
613 int volatile display_p_volatile = display_p; 613 bool volatile display_p_volatile = display_p;
614 bool volatile output_to_buffer_volatile = output_to_buffer;
615 bool volatile sa_must_free_volatile = sa_must_free;
614 int volatile fd1_volatile = fd1; 616 int volatile fd1_volatile = fd1;
615 int volatile fd_error_volatile = fd_error; 617 int volatile fd_error_volatile = fd_error;
616 int volatile fd_output_volatile = fd_output; 618 int volatile fd_output_volatile = fd_output;
617 int volatile output_to_buffer_volatile = output_to_buffer;
618 int volatile sa_must_free_volatile = sa_must_free;
619 ptrdiff_t volatile sa_count_volatile = sa_count; 619 ptrdiff_t volatile sa_count_volatile = sa_count;
620 unsigned char const **volatile new_argv_volatile = new_argv; 620 unsigned char const **volatile new_argv_volatile = new_argv;
621 621
@@ -766,11 +766,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
766 766
767 if (output_to_buffer) 767 if (output_to_buffer)
768 { 768 {
769 register int nread; 769 int nread;
770 int first = 1; 770 bool first = 1;
771 EMACS_INT total_read = 0; 771 EMACS_INT total_read = 0;
772 int carryover = 0; 772 int carryover = 0;
773 int display_on_the_fly = display_p; 773 bool display_on_the_fly = display_p;
774 struct coding_system saved_coding; 774 struct coding_system saved_coding;
775 775
776 saved_coding = process_coding; 776 saved_coding = process_coding;
@@ -1086,7 +1086,7 @@ static char **
1086add_env (char **env, char **new_env, char *string) 1086add_env (char **env, char **new_env, char *string)
1087{ 1087{
1088 char **ep; 1088 char **ep;
1089 int ok = 1; 1089 bool ok = 1;
1090 if (string == NULL) 1090 if (string == NULL)
1091 return new_env; 1091 return new_env;
1092 1092
@@ -1126,8 +1126,7 @@ add_env (char **env, char **new_env, char *string)
1126 Therefore, the superior process must save and restore the value 1126 Therefore, the superior process must save and restore the value
1127 of environ around the vfork and the call to this function. 1127 of environ around the vfork and the call to this function.
1128 1128
1129 SET_PGRP is nonzero if we should put the subprocess into a separate 1129 If SET_PGRP, put the subprocess into a separate process group.
1130 process group.
1131 1130
1132 CURRENT_DIR is an elisp string giving the path of the current 1131 CURRENT_DIR is an elisp string giving the path of the current
1133 directory the subprocess should have. Since we can't really signal 1132 directory the subprocess should have. Since we can't really signal
@@ -1135,7 +1134,8 @@ add_env (char **env, char **new_env, char *string)
1135 executable directory by the parent. */ 1134 executable directory by the parent. */
1136 1135
1137int 1136int
1138child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, Lisp_Object current_dir) 1137child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
1138 Lisp_Object current_dir)
1139{ 1139{
1140 char **env; 1140 char **env;
1141 char *pwd_var; 1141 char *pwd_var;
@@ -1394,7 +1394,7 @@ relocate_fd (int fd, int minfd)
1394} 1394}
1395#endif /* not WINDOWSNT */ 1395#endif /* not WINDOWSNT */
1396 1396
1397static int 1397static bool
1398getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value, 1398getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value,
1399 ptrdiff_t *valuelen, Lisp_Object env) 1399 ptrdiff_t *valuelen, Lisp_Object env)
1400{ 1400{
@@ -1429,7 +1429,7 @@ getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value,
1429 return 0; 1429 return 0;
1430} 1430}
1431 1431
1432static int 1432static bool
1433getenv_internal (const char *var, ptrdiff_t varlen, char **value, 1433getenv_internal (const char *var, ptrdiff_t varlen, char **value,
1434 ptrdiff_t *valuelen, Lisp_Object frame) 1434 ptrdiff_t *valuelen, Lisp_Object frame)
1435{ 1435{
diff --git a/src/lisp.h b/src/lisp.h
index 7847d454bc1..ef167ba56c0 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3330,7 +3330,7 @@ extern void setup_process_coding_systems (Lisp_Object);
3330#ifndef DOS_NT 3330#ifndef DOS_NT
3331 _Noreturn 3331 _Noreturn
3332#endif 3332#endif
3333extern int child_setup (int, int, int, char **, int, Lisp_Object); 3333extern int child_setup (int, int, int, char **, bool, Lisp_Object);
3334extern void init_callproc_1 (void); 3334extern void init_callproc_1 (void);
3335extern void init_callproc (void); 3335extern void init_callproc (void);
3336extern void set_initial_environment (void); 3336extern void set_initial_environment (void);
@@ -3586,7 +3586,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
3586extern void *record_xmalloc (size_t); 3586extern void *record_xmalloc (size_t);
3587 3587
3588#define USE_SAFE_ALLOCA \ 3588#define USE_SAFE_ALLOCA \
3589 ptrdiff_t sa_count = SPECPDL_INDEX (); int sa_must_free = 0 3589 ptrdiff_t sa_count = SPECPDL_INDEX (); bool sa_must_free = 0
3590 3590
3591/* SAFE_ALLOCA allocates a simple buffer. */ 3591/* SAFE_ALLOCA allocates a simple buffer. */
3592 3592
diff --git a/src/process.h b/src/process.h
index 55a572117c6..b963f4ca05c 100644
--- a/src/process.h
+++ b/src/process.h
@@ -184,7 +184,7 @@ pset_gnutls_cred_type (struct Lisp_Process *p, Lisp_Object val)
184 184
185/* True if we are about to fork off a synchronous process or if we 185/* True if we are about to fork off a synchronous process or if we
186 are waiting for it. */ 186 are waiting for it. */
187extern int synch_process_alive; 187extern bool synch_process_alive;
188 188
189/* Communicate exit status of sync process to from sigchld_handler 189/* Communicate exit status of sync process to from sigchld_handler
190 to Fcall_process. */ 190 to Fcall_process. */