[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r111970: print.c, process.c: Use bool
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r111970: print.c, process.c: Use bool for booleans. |
Date: |
Thu, 07 Mar 2013 18:32:21 -0800 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 111970
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2013-03-07 18:32:21 -0800
message:
print.c, process.c: Use bool for booleans.
* lisp.h (wait_reading_process_output):
* print.c (print_output_debug_flag, PRINTDECLARE, printchar)
(strout, debug_output_compilation_hack, float_to_string, print)
(print_object):
* process.c (kbd_is_on_hold, inhibit_sentinels, process_output_skip)
(decode_status, status_message, create_process, create_pty)
(Fmake_network_process, Fnetwork_interface_info)
(wait_reading_process_output, read_process_output)
(write_queue_push, write_queue_pop, process_send_signal)
(handle_child_signal, keyboard_bit_set, kbd_on_hold_p):
* process.h (struct Lisp_Process, inhibit_sentinels, kbd_on_hold_p):
Use bool for booleans.
* process.c (Fnetwork_interface_list): Remove unused local.
(connect_counter): Now EMACS_INT, not int.
modified:
src/ChangeLog
src/lisp.h
src/print.c
src/process.c
src/process.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2013-03-07 23:37:36 +0000
+++ b/src/ChangeLog 2013-03-08 02:32:21 +0000
@@ -1,3 +1,21 @@
+2013-03-08 Paul Eggert <address@hidden>
+
+ print.c, process.c: Use bool for booleans.
+ * lisp.h (wait_reading_process_output):
+ * print.c (print_output_debug_flag, PRINTDECLARE, printchar)
+ (strout, debug_output_compilation_hack, float_to_string, print)
+ (print_object):
+ * process.c (kbd_is_on_hold, inhibit_sentinels, process_output_skip)
+ (decode_status, status_message, create_process, create_pty)
+ (Fmake_network_process, Fnetwork_interface_info)
+ (wait_reading_process_output, read_process_output)
+ (write_queue_push, write_queue_pop, process_send_signal)
+ (handle_child_signal, keyboard_bit_set, kbd_on_hold_p):
+ * process.h (struct Lisp_Process, inhibit_sentinels, kbd_on_hold_p):
+ Use bool for booleans.
+ * process.c (Fnetwork_interface_list): Remove unused local.
+ (connect_counter): Now EMACS_INT, not int.
+
2013-03-08 Dmitry Antipov <address@hidden>
* bidi.c (bidi_fetch_char): Swap first and second arguments
=== modified file 'src/lisp.h'
--- a/src/lisp.h 2013-03-07 03:01:17 +0000
+++ b/src/lisp.h 2013-03-08 02:32:21 +0000
@@ -3498,10 +3498,10 @@
extern Lisp_Object QCtype, Qlocal;
extern Lisp_Object Qprocessp;
extern void kill_buffer_processes (Lisp_Object);
-extern int wait_reading_process_output (intmax_t, int, int, bool,
- Lisp_Object,
- struct Lisp_Process *,
- int);
+extern bool wait_reading_process_output (intmax_t, int, int, bool,
+ Lisp_Object,
+ struct Lisp_Process *,
+ int);
/* Max value for the first argument of wait_reading_process_output. */
#if __GNUC__ == 3 || (__GNUC__ == 4 && __GNUC_MINOR__ <= 5)
/* Work around a bug in GCC 3.4.2, known to be fixed in GCC 4.6.3.
=== modified file 'src/print.c'
--- a/src/print.c 2013-02-15 12:26:42 +0000
+++ b/src/print.c 2013-03-08 02:32:21 +0000
@@ -84,7 +84,7 @@
static void print_interval (INTERVAL interval, Lisp_Object printcharfun);
/* GDB resets this to zero on W32 to disable OutputDebugString calls. */
-int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
+bool print_output_debug_flag EXTERNALLY_VISIBLE = 1;
/* Low level output routines for characters and strings. */
@@ -101,7 +101,7 @@
ptrdiff_t old_point = -1, start_point = -1; \
ptrdiff_t old_point_byte = -1, start_point_byte = -1; \
ptrdiff_t specpdl_count = SPECPDL_INDEX (); \
- int free_print_buffer = 0; \
+ bool free_print_buffer = 0; \
bool multibyte \
= !NILP (BVAR (current_buffer, enable_multibyte_characters)); \
Lisp_Object original
@@ -241,7 +241,7 @@
}
else
{
- int multibyte_p
+ bool multibyte_p
= !NILP (BVAR (current_buffer, enable_multibyte_characters));
setup_echo_area_for_printing (multibyte_p);
@@ -290,7 +290,7 @@
here, that's the reason we don't call printchar to do the
job. */
int i;
- int multibyte_p
+ bool multibyte_p
= !NILP (BVAR (current_buffer, enable_multibyte_characters));
setup_echo_area_for_printing (multibyte_p);
@@ -508,10 +508,10 @@
specbind (Qstandard_output, buf);
}
-static void print (Lisp_Object obj, register Lisp_Object printcharfun, int
escapeflag);
-static void print_preprocess (Lisp_Object obj);
-static void print_preprocess_string (INTERVAL interval, Lisp_Object arg);
-static void print_object (Lisp_Object obj, register Lisp_Object printcharfun,
int escapeflag);
+static void print (Lisp_Object, Lisp_Object, bool);
+static void print_preprocess (Lisp_Object);
+static void print_preprocess_string (INTERVAL, Lisp_Object);
+static void print_object (Lisp_Object, Lisp_Object, bool);
DEFUN ("terpri", Fterpri, Sterpri, 0, 1, 0,
doc: /* Output a newline to stream PRINTCHARFUN.
@@ -727,9 +727,9 @@
/* This function is never called. Its purpose is to prevent
print_output_debug_flag from being optimized away. */
-extern void debug_output_compilation_hack (int) EXTERNALLY_VISIBLE;
+extern void debug_output_compilation_hack (bool) EXTERNALLY_VISIBLE;
void
-debug_output_compilation_hack (int x)
+debug_output_compilation_hack (bool x)
{
print_output_debug_flag = x;
}
@@ -967,7 +967,7 @@
static char const NaN_string[] = "0.0e+NaN";
int i;
union { double d; char c[sizeof (double)]; } u_data, u_minus_zero;
- int negative = 0;
+ bool negative = 0;
u_data.d = data;
u_minus_zero.d = - 0.0;
for (i = 0; i < sizeof (double); i++)
@@ -1064,7 +1064,7 @@
static void
-print (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag)
+print (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
{
new_backquote_output = 0;
@@ -1314,7 +1314,7 @@
}
static void
-print_object (Lisp_Object obj, register Lisp_Object printcharfun, int
escapeflag)
+print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
{
char buf[max (sizeof "from..to..in " + 2 * INT_STRLEN_BOUND (EMACS_INT),
max (sizeof " . #" + INT_STRLEN_BOUND (printmax_t),
@@ -1396,7 +1396,7 @@
ptrdiff_t size_byte;
/* 1 means we must ensure that the next character we output
cannot be taken as part of a hex character escape. */
- int need_nonhex = 0;
+ bool need_nonhex = 0;
bool multibyte = STRING_MULTIBYTE (obj);
GCPRO1 (obj);
@@ -1508,10 +1508,10 @@
case Lisp_Symbol:
{
- register int confusing;
- register unsigned char *p = SDATA (SYMBOL_NAME (obj));
- register unsigned char *end = p + SBYTES (SYMBOL_NAME (obj));
- register int c;
+ bool confusing;
+ unsigned char *p = SDATA (SYMBOL_NAME (obj));
+ unsigned char *end = p + SBYTES (SYMBOL_NAME (obj));
+ int c;
ptrdiff_t i, i_byte;
ptrdiff_t size_byte;
Lisp_Object name;
=== modified file 'src/process.c'
--- a/src/process.c 2013-02-17 16:49:27 +0000
+++ b/src/process.c 2013-03-08 02:32:21 +0000
@@ -146,13 +146,13 @@
Lisp_Object Quser, Qgroup, Qetime, Qpcpu, Qpmem, Qtime, Qctime;
Lisp_Object QCname, QCtype;
-/* Non-zero if keyboard input is on hold, zero otherwise. */
+/* True if keyboard input is on hold, zero otherwise. */
-static int kbd_is_on_hold;
+static bool kbd_is_on_hold;
/* Nonzero means don't run process sentinels. This is used
when exiting. */
-int inhibit_sentinels;
+bool inhibit_sentinels;
#ifdef subprocesses
@@ -234,9 +234,9 @@
static int process_output_delay_count;
-/* Non-zero if any process has non-nil read_output_skip. */
+/* True if any process has non-nil read_output_skip. */
-static int process_output_skip;
+static bool process_output_skip;
#else
#define process_output_delay_count 0
@@ -244,7 +244,7 @@
static void create_process (Lisp_Object, char **, Lisp_Object);
#ifdef USABLE_SIGIO
-static int keyboard_bit_set (SELECT_TYPE *);
+static bool keyboard_bit_set (SELECT_TYPE *);
#endif
static void deactivate_process (Lisp_Object);
static void status_notify (struct Lisp_Process *);
@@ -527,7 +527,7 @@
and store them individually through the three pointers. */
static void
-decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, int *coredump)
+decode_status (Lisp_Object l, Lisp_Object *symbol, int *code, bool *coredump)
{
Lisp_Object tem;
@@ -554,7 +554,8 @@
{
Lisp_Object status = p->status;
Lisp_Object symbol;
- int code, coredump;
+ int code;
+ bool coredump;
Lisp_Object string, string2;
decode_status (status, &symbol, &code, &coredump);
@@ -1579,7 +1580,7 @@
sigset_t blocked;
/* Use volatile to protect variables from being clobbered by vfork. */
volatile int forkin, forkout;
- volatile int pty_flag = 0;
+ volatile bool pty_flag = 0;
volatile Lisp_Object lisp_pty_name = Qnil;
volatile Lisp_Object encoded_current_dir;
@@ -1871,7 +1872,7 @@
create_pty (Lisp_Object process)
{
int inchannel, outchannel;
- int pty_flag = 0;
+ bool pty_flag = 0;
inchannel = outchannel = -1;
@@ -2819,8 +2820,9 @@
Lisp_Object tem;
Lisp_Object name, buffer, host, service, address;
Lisp_Object filter, sentinel;
- int is_non_blocking_client = 0;
- int is_server = 0, backlog = 5;
+ bool is_non_blocking_client = 0;
+ bool is_server = 0;
+ int backlog = 5;
int socktype;
int family = -1;
@@ -3497,7 +3499,7 @@
struct ifreq *ifreq;
void *buf = NULL;
ptrdiff_t buf_size = 512;
- int s, i;
+ int s;
Lisp_Object res;
s = socket (AF_INET, SOCK_STREAM, 0);
@@ -3535,7 +3537,6 @@
int len = sizeof (*ifreq);
#endif
char namebuf[sizeof (ifq->ifr_name) + 1];
- i += len;
ifreq = (struct ifreq *) ((char *) ifreq + len);
if (ifq->ifr_addr.sa_family != AF_INET)
@@ -3645,7 +3646,7 @@
Lisp_Object res = Qnil;
Lisp_Object elt;
int s;
- int any = 0;
+ bool any = 0;
#if (! (defined SIOCGIFHWADDR && defined HAVE_STRUCT_IFREQ_IFR_HWADDR) \
&& defined HAVE_GETIFADDRS && defined LLADDR)
struct ifaddrs *ifap;
@@ -3931,7 +3932,7 @@
/* Accept a connection for server process SERVER on CHANNEL. */
-static int connect_counter = 0;
+static EMACS_INT connect_counter = 0;
static void
server_accept_connection (Lisp_Object server, int channel)
@@ -4186,7 +4187,7 @@
process. The return value is true if we read some input from
that process.
- If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC
+ If JUST_WAIT_PROC is nonzero, handle only output from WAIT_PROC
(suspending output from other processes). A negative value
means don't run any timers either.
@@ -4194,22 +4195,23 @@
received input from that process before the timeout elapsed.
Otherwise, return true if we received input from any process. */
-int
+bool
wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
bool do_display,
Lisp_Object wait_for_cell,
struct Lisp_Process *wait_proc, int just_wait_proc)
{
- register int channel, nfds;
+ int channel, nfds;
SELECT_TYPE Available;
SELECT_TYPE Writeok;
- int check_write;
- int check_delay, no_avail;
+ bool check_write;
+ int check_delay;
+ bool no_avail;
int xerrno;
Lisp_Object proc;
EMACS_TIME timeout, end_time;
int wait_channel = -1;
- int got_some_input = 0;
+ bool got_some_input = 0;
ptrdiff_t count = SPECPDL_INDEX ();
FD_ZERO (&Available);
@@ -4246,7 +4248,7 @@
while (1)
{
- int timeout_reduced_for_timers = 0;
+ bool timeout_reduced_for_timers = 0;
/* If calling from keyboard input, do not quit
since we want to return C-g as an input character.
@@ -4624,7 +4626,7 @@
unsigned old_timers_run = timers_run;
struct buffer *old_buffer = current_buffer;
Lisp_Object old_window = selected_window;
- int leave = 0;
+ bool leave = 0;
if (detect_input_pending_run_timers (do_display))
{
@@ -4945,7 +4947,7 @@
else
#endif
{
- int buffered = 0 <= proc_buffered_char[channel];
+ bool buffered = 0 <= proc_buffered_char[channel];
if (buffered)
{
chars[carryover] = proc_buffered_char[channel];
@@ -5261,7 +5263,7 @@
static void
write_queue_push (struct Lisp_Process *p, Lisp_Object input_obj,
- const char *buf, ptrdiff_t len, int front)
+ const char *buf, ptrdiff_t len, bool front)
{
ptrdiff_t offset;
Lisp_Object entry, obj;
@@ -5286,10 +5288,10 @@
}
/* Remove the first element in the write_queue of process P, put its
- contents in OBJ, BUF and LEN, and return non-zero. If the
- write_queue is empty, return zero. */
+ contents in OBJ, BUF and LEN, and return true. If the
+ write_queue is empty, return false. */
-static int
+static bool
write_queue_pop (struct Lisp_Process *p, Lisp_Object *obj,
const char **buf, ptrdiff_t *len)
{
@@ -5650,7 +5652,7 @@
If CURRENT_GROUP is lambda, that means send to the process group
that currently owns the terminal, but only if it is NOT the shell itself.
- If NOMSG is zero, insert signal-announcements into process's buffers
+ If NOMSG is false, insert signal-announcements into process's buffers
right away.
If we can, we try to signal PROCESS by sending control characters
@@ -5659,12 +5661,12 @@
static void
process_send_signal (Lisp_Object process, int signo, Lisp_Object current_group,
- int nomsg)
+ bool nomsg)
{
Lisp_Object proc;
- register struct Lisp_Process *p;
+ struct Lisp_Process *p;
pid_t gid;
- int no_pgrp = 0;
+ bool no_pgrp = 0;
proc = get_process (process);
p = XPROCESS (proc);
@@ -6161,7 +6163,7 @@
/* If process has terminated, stop waiting for its output. */
if (WIFSIGNALED (status) || WIFEXITED (status))
{
- int clear_desc_flag = 0;
+ bool clear_desc_flag = 0;
p->alive = 0;
if (p->infd >= 0)
clear_desc_flag = 1;
@@ -6504,10 +6506,10 @@
# ifdef USABLE_SIGIO
-/* Return nonzero if *MASK has a bit set
+/* Return true if *MASK has a bit set
that corresponds to one of the keyboard input descriptors. */
-static int
+static bool
keyboard_bit_set (fd_set *mask)
{
int fd;
@@ -6557,7 +6559,7 @@
Return true if we received input from any process. */
-int
+bool
wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
bool do_display,
Lisp_Object wait_for_cell,
@@ -6589,7 +6591,7 @@
while (1)
{
- int timeout_reduced_for_timers = 0;
+ bool timeout_reduced_for_timers = 0;
SELECT_TYPE waitchannels;
int xerrno;
@@ -6940,9 +6942,9 @@
kbd_is_on_hold = 0;
}
-/* Return non-zero if keyboard input is on hold, zero otherwise. */
+/* Return true if keyboard input is on hold, zero otherwise. */
-int
+bool
kbd_on_hold_p (void)
{
return kbd_is_on_hold;
=== modified file 'src/process.h'
--- a/src/process.h 2013-01-02 16:13:04 +0000
+++ b/src/process.h 2013-03-08 02:32:21 +0000
@@ -159,7 +159,7 @@
gnutls_anon_client_credentials_t gnutls_anon_cred;
int gnutls_log_level;
int gnutls_handshakes_tried;
- int gnutls_p;
+ unsigned int gnutls_p : 1;
#endif
};
@@ -185,9 +185,9 @@
}
#endif
-/* Nonzero means don't run process sentinels. This is used
+/* True means don't run process sentinels. This is used
when exiting. */
-extern int inhibit_sentinels;
+extern bool inhibit_sentinels;
extern Lisp_Object Qeuid, Qegid, Qcomm, Qstate, Qppid, Qpgrp, Qsess, Qttname;
extern Lisp_Object Qminflt, Qmajflt, Qcminflt, Qcmajflt, Qutime, Qstime;
@@ -209,7 +209,7 @@
extern void hold_keyboard_input (void);
extern void unhold_keyboard_input (void);
-extern int kbd_on_hold_p (void);
+extern bool kbd_on_hold_p (void);
typedef void (*fd_callback) (int fd, void *data);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r111970: print.c, process.c: Use bool for booleans.,
Paul Eggert <=