Commit 96c06863 authored by Paul Eggert's avatar Paul Eggert

Use bool for boolean, focusing on headers.

* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK):
Use bool for boolean.
* lib-src/emacsclient.c, lib-src/etags.c, lib-src/hexl.c (FALSE, TRUE):
Remove.  All uses replaced with uncapitalized version.
* lib-src/emacsclient.c (message):
* lib-src/etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names):
* lib-src/hexl.c (un_flag, iso_flag, endian):
* lib-src/pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next)
(pop_trash):
Use bool for boolean.
* lib-src/etags.c (bool): Remove.
* lib-src/etags.c (globals, members, declarations, no_line_directive)
(no_duplicates): Use 'int' for boolean values that getopt requires
to be 'int'.  Formerly, these were 'bool' and 'bool' was 'int',
but we can no longer rely on this implementation.
* lib-src/pop.h (struct _popserver): Use bool_bf for boolean bit-fields.
* lwlib/xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields.
* src/atimer.h, src/lisp.h, src/syssignal.h, src/syswait.h, src/unexelf.c:
No need to include <stdbool.h>, since conf_post.h does it now.
* src/buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION)
(BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P)
(SET_PER_BUFFER_VALUE_P):
* src/ccl.c, src/ccl.h (setup_ccl_program):
* src/ccl.h (CHECK_CCL_PROGRAM):
* src/character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR)
(CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY)
(PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE)
(FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
(FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
(DEC_BOTH, BUF_INC_POS, BUF_DEC_POS):
* src/charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID)
(CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET)
(CHARSET_FAST_MAP_SET):
* src/coding.c (decode_coding_ccl, encode_coding_ccl):
* src/coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC)
(CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2)
(JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE)
(ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8)
(decode_coding_c_string):
* src/composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE):
* src/conf_post.h (has_attribute):
* src/dispextern.h (trace_redisplay_p):
(INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE)
(SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH)
(SET_GLYPH_FROM_CHAR_GLYPH):
(WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P)
(FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P)
(PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p)
(cursor_in_mouse_face_p):
* src/dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows)
(blank_row, prepare_desired_row)
(build_frame_matrix_from_leaf_window, make_current)
(mirror_make_current, mirrored_line_dance, mirror_line_dance)
(update_window, scrolling_window, update_frame_line):
* src/disptab.h (GLYPH_FOLLOW_ALIASES):
* src/editfns.c (Fformat):
* src/font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC)
(FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE)
(FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC)
(FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC)
(FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY)
(CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG)
(FONT_DEFERRED_LOG):
* src/frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P):
(FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME)
(FRAME_MOUSE_UPDATE):
* src/fringe.c (Fdefine_fringe_bitmap):
* src/image.c (x_create_bitmap_from_data, x_create_bitmap_mask)
(x_create_bitmap_from_xpm_data, xpm_load_image):
* src/intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT)
(set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE)
(MERGE_INTERVAL_CACHE):
* src/keymap.h (KEYMAPP):
* src/lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE)
(STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP)
(CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER)
(CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER)
(DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
(DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT)
(RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE)
(SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp):
* src/syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX)
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
(SETUP_BUFFER_SYNTAX_TABLE):
* src/systime.h (timespec_valid_p):
* src/term.c (save_and_enable_current_matrix):
* src/window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P):
* src/xdisp.c (in_display_vector_p, display_tool_bar_line)
(redisplay_internal, try_window_reusing_current_matrix)
(sync_frame_with_window_matrix_rows, try_window_id)
(display_menu_bar, display_tty_menu_item, display_mode_line)
(coords_in_mouse_face_p, cursor_in_mouse_face_p):
* src/xmenu.c (xmenu_show):
* src/xterm.c (use_xim, x_term_init):
* src/xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET)
(struct x_bitmap_record):
Use bool for booleans.
* src/ccl.c (struct buffer_text):
* src/ccl.h (struct ccl_program):
* src/charset.h (struct charset):
* src/cm.h (struct cm):
* src/coding.h (struct iso_2022_spec, struct coding_system):
* src/dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row)
(struct glyph_string, struct face, struct face_cache)
(struct bidi_string_data, struct bidi_it)
(struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo)
(struct image):
* src/editfns.c (Fformat):
* src/frame.h (struct frame):
* src/fringe.c (struct fringe_bitmap):
* src/intervals.h (struct interval):
* src/keyboard.h (struct kboard):
* src/lisp.h (struct Lisp_Symbol, struct Lisp_Misc_Any, struct Lisp_Marker)
(struct Lisp_Overlay, struct Lisp_Save_Value, struct Lisp_Free)
(struct Lisp_Buffer_Local_Value, union specbinding):
* src/macfont.m (struct macfont_info):
* src/process.h (struct Lisp_Process):
* src/termchar.h (struct tty_display_info):
* src/window.h (struct window):
* src/xterm.h (struct x_output):
Use bool_bf for boolean bit-fields.
* src/ccl.c (setup_ccl_program): Now returns bool instead of -1 or 0.
All callers changed.
* src/ccl.h (struct ccl_program): Remove unused members private_state,
src_multibyte, dst_multibyte, cr_consumed, suppress_error,
eight_bit_control.
(struct ccl_spec): Remove unused members cr_carryover,
eight_bit_carryover.
* src/conf_post.h: Include <stdbool.h>.
(bool_bf): New type.
* src/dispextern.h (TRACE, PREPARE_FACE_FOR_DISPLAY):
* src/interval.h (RESET_INTERVAL, COPY_INTERVAL_CACHE, MERGE_INTERVAL_CACHE)
Surround statement macro with proper 'do { ... } while (false)' brackets.
(SET_MATRIX_ROW_ENABLED_P): Assume 2nd arg is bool.
(PRODUCE_GLYPHS): Simplify use of boolean.
* src/fileio.c (Fcopy_file):
If I is an integer, prefer 'if (I != 0)' to 'if (I)'.
* src/lisp.h (UNGCPRO): Return void, not int.
(FOR_EACH_TAIL): Use void expression, not int expression.
* src/region-cache.c: Reindent.
* src/region-cache.h: Copy comments from region-cache.c, to fix
incorrect remarks about booleans.
parent 5ae811dd
2013-12-14 Paul Eggert <eggert@cs.ucla.edu>
Use bool for boolean, focusing on headers.
* configure.ac (PTY_OPEN, GC_MARK_SECONDARY_STACK):
Use bool for boolean.
2013-12-14 Dani Moncayo <dmoncayo@gmail.com>
* configure.ac (srcdir) [MINGW32]: Convert to an absolute MSYS
......
......@@ -4067,7 +4067,7 @@ case $opsys in
cygwin )
AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)])
dnl multi-line AC_DEFINEs are hard. :(
AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)])
AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (false)])
AC_DEFINE(PTY_NAME_SPRINTF, [])
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
;;
......@@ -4080,7 +4080,7 @@ case $opsys in
dnl Note that openpty may fork via grantpt on Mac OS X 10.4/Darwin 8.
dnl But we don't have to block SIGCHLD because it is blocked in the
dnl implementation of grantpt.
AC_DEFINE(PTY_OPEN, [ do { int slave; if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) fd = -1; else emacs_close (slave); } while (0)])
AC_DEFINE(PTY_OPEN, [ do { int slave; if (openpty (&fd, &slave, pty_name, NULL, NULL) == -1) fd = -1; else emacs_close (slave); } while (false)])
AC_DEFINE(PTY_NAME_SPRINTF, [])
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [])
;;
......@@ -4099,7 +4099,7 @@ case $opsys in
AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { emacs_close (fd); return -1; } snprintf (pty_name, PTY_NAME_SIZE, "%s", ptyname); }])
dnl if HAVE_POSIX_OPENPT
if test "x$ac_cv_func_posix_openpt" = xyes; then
AC_DEFINE(PTY_OPEN, [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (0)])
AC_DEFINE(PTY_OPEN, [do { fd = posix_openpt (O_RDWR | O_CLOEXEC | O_NOCTTY); if (fd < 0 && errno == EINVAL) fd = posix_openpt (O_RDWR | O_NOCTTY); } while (false)])
AC_DEFINE(PTY_NAME_SPRINTF, [])
dnl if HAVE_GETPT
elif test "x$ac_cv_func_getpt" = xyes; then
......@@ -4232,7 +4232,7 @@ case $opsys in
# error "not ia64"
#endif
]], [[]])], AC_DEFINE(GC_MARK_SECONDARY_STACK(),
[do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (0)],
[do { extern void *__libc_ia64_register_backing_store_base; __builtin_ia64_flushrs (); mark_memory (__libc_ia64_register_backing_store_base, __builtin_ia64_bsp ());} while (false)],
[Mark a secondary stack, like the register stack on the ia64.]), [])
;;
......
2013-12-14 Paul Eggert <eggert@cs.ucla.edu>
Use bool for boolean, focusing on headers.
* emacsclient.c, etags.c, hexl.c (FALSE, TRUE):
Remove. All uses replaced with uncapitalized version.
* emacsclient.c (message):
* etags.c (make_tag, pfnote, consider_token, make_C_tag, lang_names):
* hexl.c (un_flag, iso_flag, endian):
* pop.c (pop_debug, pop_open, pop_multi_first, pop_multi_next)
(pop_trash):
Use bool for boolean.
* etags.c (bool): Remove.
* etags.c (globals, members, declarations, no_line_directive)
(no_duplicates): Use 'int' for boolean values that getopt requires
to be 'int'. Formerly, these were 'bool' and 'bool' was 'int',
but we can no longer rely on this implementation.
* pop.h (struct _popserver): Use bool_bf for boolean bit-fields.
2013-11-14 Paul Eggert <eggert@cs.ucla.edu>
* ebrowse.c (xstrdup):
......
......@@ -103,14 +103,6 @@ char *getenv (const char *);
#define EXIT_FAILURE 1
#endif
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
/* Additional space when allocating buffers for filenames, etc. */
#define EXTRA_SPACE 100
......@@ -433,9 +425,9 @@ ttyname (int fd)
/* Display a normal or error message.
On Windows, use a message box if compiled as a Windows app. */
static void message (int, const char *, ...) ATTRIBUTE_FORMAT_PRINTF (2, 3);
static void message (bool, const char *, ...) ATTRIBUTE_FORMAT_PRINTF (2, 3);
static void
message (int is_error, const char *format, ...)
message (bool is_error, const char *format, ...)
{
va_list args;
......@@ -528,7 +520,7 @@ decode_options (int argc, char **argv)
break;
case 'V':
message (FALSE, "emacsclient %s\n", VERSION);
message (false, "emacsclient %s\n", VERSION);
exit (EXIT_SUCCESS);
break;
......@@ -555,7 +547,7 @@ decode_options (int argc, char **argv)
break;
default:
message (TRUE, "Try `%s --help' for more information\n", progname);
message (true, "Try `%s --help' for more information\n", progname);
exit (EXIT_FAILURE);
break;
}
......@@ -614,7 +606,7 @@ decode_options (int argc, char **argv)
if (alternate_editor && alternate_editor[0] == '\0')
{
message (TRUE, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\
message (true, "--alternate-editor argument or ALTERNATE_EDITOR variable cannot be\n\
an empty string");
exit (EXIT_FAILURE);
}
......@@ -629,7 +621,7 @@ print_help_and_exit (void)
message aligns properly both in a tty and in a Windows message box.
Please try to preserve them; otherwise the output is very hard to read
when using emacsclientw. */
message (FALSE,
message (false,
"Usage: %s [OPTIONS] FILE...\n%s%s%s", progname, "\
Tell the Emacs server to visit the specified files.\n\
Every FILE can be either just a FILENAME or [+LINE[:COLUMN]] FILENAME.\n\
......@@ -679,7 +671,7 @@ fail (void)
int i = optind - 1;
execvp (alternate_editor, main_argv + i);
message (TRUE, "%s: error executing alternate editor \"%s\"\n",
message (true, "%s: error executing alternate editor \"%s\"\n",
progname, alternate_editor);
}
exit (EXIT_FAILURE);
......@@ -693,7 +685,7 @@ main (int argc, char **argv)
{
main_argv = argv;
progname = argv[0];
message (TRUE, "%s: Sorry, the Emacs server is supported only\n"
message (true, "%s: Sorry, the Emacs server is supported only\n"
"on systems with Berkeley sockets.\n",
argv[0]);
fail ();
......@@ -724,11 +716,11 @@ sock_err_message (const char *function_name)
| FORMAT_MESSAGE_ARGUMENT_ARRAY,
NULL, WSAGetLastError (), 0, (LPTSTR)&msg, 0, NULL);
message (TRUE, "%s: %s: %s\n", progname, function_name, msg);
message (true, "%s: %s: %s\n", progname, function_name, msg);
LocalFree (msg);
#else
message (TRUE, "%s: %s: %s\n", progname, function_name, strerror (errno));
message (true, "%s: %s: %s\n", progname, function_name, strerror (errno));
#endif
}
......@@ -759,7 +751,7 @@ send_to_emacs (HSOCKET s, const char *data)
int sent = send (s, send_buffer, sblen, 0);
if (sent < 0)
{
message (TRUE, "%s: failed to send %d bytes to socket: %s\n",
message (true, "%s: failed to send %d bytes to socket: %s\n",
progname, sblen, strerror (errno));
fail ();
}
......@@ -854,25 +846,25 @@ static int
file_name_absolute_p (const char *filename)
{
/* Sanity check, it shouldn't happen. */
if (! filename) return FALSE;
if (! filename) return false;
/* /xxx is always an absolute path. */
if (filename[0] == '/') return TRUE;
if (filename[0] == '/') return true;
/* Empty filenames (which shouldn't happen) are relative. */
if (filename[0] == '\0') return FALSE;
if (filename[0] == '\0') return false;
#ifdef WINDOWSNT
/* X:\xxx is always absolute. */
if (isalpha ((unsigned char) filename[0])
&& filename[1] == ':' && (filename[2] == '\\' || filename[2] == '/'))
return TRUE;
return true;
/* Both \xxx and \\xxx\yyy are absolute. */
if (filename[0] == '\\') return TRUE;
if (filename[0] == '\\') return true;
#endif
return FALSE;
return false;
}
#ifdef WINDOWSNT
......@@ -891,7 +883,7 @@ initialize_sockets (void)
if (WSAStartup (MAKEWORD (2, 0), &wsaData))
{
message (TRUE, "%s: error initializing WinSock2\n", progname);
message (true, "%s: error initializing WinSock2\n", progname);
exit (EXIT_FAILURE);
}
......@@ -942,14 +934,14 @@ get_server_config (const char *config_file, struct sockaddr_in *server,
}
if (! config)
return FALSE;
return false;
if (fgets (dotted, sizeof dotted, config)
&& (port = strchr (dotted, ':')))
*port++ = '\0';
else
{
message (TRUE, "%s: invalid configuration info\n", progname);
message (true, "%s: invalid configuration info\n", progname);
exit (EXIT_FAILURE);
}
......@@ -959,13 +951,13 @@ get_server_config (const char *config_file, struct sockaddr_in *server,
if (! fread (authentication, AUTH_KEY_LENGTH, 1, config))
{
message (TRUE, "%s: cannot read authentication info\n", progname);
message (true, "%s: cannot read authentication info\n", progname);
exit (EXIT_FAILURE);
}
fclose (config);
return TRUE;
return true;
}
static HSOCKET
......@@ -980,7 +972,7 @@ set_tcp_socket (const char *local_server_file)
return INVALID_SOCKET;
if (server.sin_addr.s_addr != inet_addr ("127.0.0.1") && !quiet)
message (FALSE, "%s: connected to remote socket at %s\n",
message (false, "%s: connected to remote socket at %s\n",
progname, inet_ntoa (server.sin_addr));
/* Open up an AF_INET socket. */
......@@ -1033,7 +1025,7 @@ find_tty (const char **tty_type, const char **tty_name, int noabort)
return 0;
else
{
message (TRUE, "%s: could not get terminal name\n", progname);
message (true, "%s: could not get terminal name\n", progname);
fail ();
}
}
......@@ -1044,7 +1036,7 @@ find_tty (const char **tty_type, const char **tty_name, int noabort)
return 0;
else
{
message (TRUE, "%s: please set the TERM variable to your terminal type\n",
message (true, "%s: please set the TERM variable to your terminal type\n",
progname);
fail ();
}
......@@ -1057,7 +1049,7 @@ find_tty (const char **tty_type, const char **tty_name, int noabort)
else
{
/* This causes nasty, MULTI_KBOARD-related input lockouts. */
message (TRUE, "%s: opening a frame in an Emacs term buffer"
message (true, "%s: opening a frame in an Emacs term buffer"
" is not supported\n", progname);
fail ();
}
......@@ -1188,7 +1180,7 @@ set_local_socket (const char *local_socket_name)
/* Open up an AF_UNIX socket in this person's home directory. */
if ((s = socket (AF_UNIX, SOCK_STREAM, 0)) < 0)
{
message (TRUE, "%s: socket: %s\n", progname, strerror (errno));
message (true, "%s: socket: %s\n", progname, strerror (errno));
return INVALID_SOCKET;
}
......@@ -1239,7 +1231,7 @@ set_local_socket (const char *local_socket_name)
strcpy (server.sun_path, local_socket_name);
else
{
message (TRUE, "%s: socket-name %s too long\n",
message (true, "%s: socket-name %s too long\n",
progname, local_socket_name);
fail ();
}
......@@ -1278,7 +1270,7 @@ set_local_socket (const char *local_socket_name)
strcpy (server.sun_path, user_socket_name);
else
{
message (TRUE, "%s: socket-name %s too long\n",
message (true, "%s: socket-name %s too long\n",
progname, user_socket_name);
exit (EXIT_FAILURE);
}
......@@ -1302,7 +1294,7 @@ set_local_socket (const char *local_socket_name)
we are root. */
if (0 != geteuid ())
{
message (TRUE, "%s: Invalid socket owner\n", progname);
message (true, "%s: Invalid socket owner\n", progname);
return INVALID_SOCKET;
}
break;
......@@ -1310,12 +1302,12 @@ set_local_socket (const char *local_socket_name)
case 2:
/* `stat' failed */
if (saved_errno == ENOENT)
message (TRUE,
message (true,
"%s: can't find socket; have you started the server?\n\
To start the server in Emacs, type \"M-x server-start\".\n",
progname);
else
message (TRUE, "%s: can't stat %s: %s\n",
message (true, "%s: can't stat %s: %s\n",
progname, server.sun_path, strerror (saved_errno));
return INVALID_SOCKET;
}
......@@ -1324,7 +1316,7 @@ To start the server in Emacs, type \"M-x server-start\".\n",
if (connect (s, (struct sockaddr *) &server, strlen (server.sun_path) + 2)
< 0)
{
message (TRUE, "%s: connect: %s\n", progname, strerror (errno));
message (true, "%s: connect: %s\n", progname, strerror (errno));
return INVALID_SOCKET;
}
......@@ -1347,7 +1339,7 @@ set_socket (int no_exit_if_error)
s = set_local_socket (socket_name);
if ((s != INVALID_SOCKET) || no_exit_if_error)
return s;
message (TRUE, "%s: error accessing socket \"%s\"\n",
message (true, "%s: error accessing socket \"%s\"\n",
progname, socket_name);
exit (EXIT_FAILURE);
}
......@@ -1363,7 +1355,7 @@ set_socket (int no_exit_if_error)
if ((s != INVALID_SOCKET) || no_exit_if_error)
return s;
message (TRUE, "%s: error accessing server file \"%s\"\n",
message (true, "%s: error accessing server file \"%s\"\n",
progname, local_server_file);
exit (EXIT_FAILURE);
}
......@@ -1381,7 +1373,7 @@ set_socket (int no_exit_if_error)
return s;
/* No implicit or explicit socket, and no alternate editor. */
message (TRUE, "%s: No socket or alternate editor. Please use:\n\n"
message (true, "%s: No socket or alternate editor. Please use:\n\n"
#ifndef NO_SOCKETS_IN_FILE_SYSTEM
"\t--socket-name\n"
#endif
......@@ -1490,15 +1482,15 @@ start_daemon_and_retry_set_socket (void)
if ((w == -1) || !WIFEXITED (status) || WEXITSTATUS (status))
{
message (TRUE, "Error: Could not start the Emacs daemon\n");
message (true, "Error: Could not start the Emacs daemon\n");
exit (EXIT_FAILURE);
}
/* Try connecting, the daemon should have started by now. */
message (TRUE, "Emacs daemon should have started, trying to connect again\n");
message (true, "Emacs daemon should have started, trying to connect again\n");
if ((emacs_socket = set_socket (1)) == INVALID_SOCKET)
{
message (TRUE, "Error: Cannot connect even after starting the Emacs daemon\n");
message (true, "Error: Cannot connect even after starting the Emacs daemon\n");
exit (EXIT_FAILURE);
}
}
......@@ -1526,7 +1518,7 @@ start_daemon_and_retry_set_socket (void)
d_argv[1] = daemon_arg;
}
execvp ("emacs", d_argv);
message (TRUE, "%s: error starting emacs daemon\n", progname);
message (true, "%s: error starting emacs daemon\n", progname);
}
#endif /* WINDOWSNT */
}
......@@ -1556,7 +1548,7 @@ main (int argc, char **argv)
if ((argc - optind < 1) && !eval && current_frame)
{
message (TRUE, "%s: file name or argument required\n"
message (true, "%s: file name or argument required\n"
"Try `%s --help' for more information\n",
progname, progname);
exit (EXIT_FAILURE);
......@@ -1579,7 +1571,7 @@ main (int argc, char **argv)
cwd = get_current_dir_name ();
if (cwd == 0)
{
message (TRUE, "%s: %s\n", progname,
message (true, "%s: %s\n", progname,
"Cannot get current working directory");
fail ();
}
......
This diff is collapsed.
......@@ -37,12 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#define DEFAULT_GROUPING 0x01
#define DEFAULT_BASE 16
#undef TRUE
#undef FALSE
#define TRUE (1)
#define FALSE (0)
int base = DEFAULT_BASE, un_flag = FALSE, iso_flag = FALSE, endian = 1;
int base = DEFAULT_BASE;
bool un_flag = false, iso_flag = false, endian = true;
int group_by = DEFAULT_GROUPING;
char *progname;
......@@ -83,7 +79,7 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "-un") || !strcmp (*argv, "-de"))
{
un_flag = TRUE;
un_flag = true;
--argc; argv++;
}
else if (!strcmp (*argv, "-hex"))
......@@ -93,7 +89,7 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "-iso"))
{
iso_flag = TRUE;
iso_flag = true;
--argc; argv++;
}
else if (!strcmp (*argv, "-oct"))
......@@ -103,12 +99,12 @@ main (int argc, char **argv)
}
else if (!strcmp (*argv, "-big-endian"))
{
endian = 1;
endian = true;
--argc; argv++;
}
else if (!strcmp (*argv, "-little-endian"))
{
endian = 0;
endian = false;
--argc; argv++;
}
else if (!strcmp (*argv, "-group-by-8-bits"))
......@@ -129,7 +125,7 @@ main (int argc, char **argv)
else if (!strcmp (*argv, "-group-by-64-bits"))
{
group_by = 0x07;
endian = 0;
endian = false;
--argc; argv++;
}
else
......
......@@ -124,7 +124,7 @@ static char *find_crlf (char *, int);
#endif
char pop_error[ERROR_MAX];
int pop_debug = 0;
bool pop_debug = false;
/*
* Function: pop_open (char *host, char *username, char *password,
......@@ -269,8 +269,8 @@ pop_open (char *host, char *username, char *password, int flags)
server->data = 0;
server->buffer_index = 0;
server->buffer_size = GETLINE_MIN;
server->in_multi = 0;
server->trash_started = 0;
server->in_multi = false;
server->trash_started = false;
if (getok (server))
return (0);
......@@ -686,7 +686,7 @@ pop_multi_first (popserver server, const char *command, char **response)
else if (0 == strncmp (*response, "+OK", 3))
{
for (*response += 3; **response == ' '; (*response)++) /* empty */;
server->in_multi = 1;
server->in_multi = true;
return (0);
}
else
......@@ -728,7 +728,7 @@ pop_multi_next (popserver server, char **line)
if (! fromserver[1])
{
*line = 0;
server->in_multi = 0;
server->in_multi = false;
return (0);
}
else
......@@ -1546,7 +1546,7 @@ pop_trash (popserver server)
/* avoid recursion; sendline can call pop_trash */
if (server->trash_started)
return;
server->trash_started = 1;
server->trash_started = true;
sendline (server, "RSET");
sendline (server, "QUIT");
......
......@@ -27,15 +27,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* size when it needs to grow */
extern char pop_error[];
extern int pop_debug;
extern bool pop_debug;
struct _popserver
{
int file, data;
char *buffer;
int buffer_size, buffer_index;
int in_multi;
int trash_started;
bool_bf in_multi : 1;
bool_bf trash_started : 1;
};
typedef struct _popserver *popserver;
......@@ -73,4 +73,3 @@ extern int pop_last (popserver server);
extern int pop_reset (popserver server);
extern int pop_quit (popserver server);
extern void pop_close (popserver);
2013-12-14 Paul Eggert <eggert@cs.ucla.edu>
Use bool for boolean, focusing on headers.
* xlwmenuP.h (XlwMenu_part): Use bool_bf for boolean bit-fields.
2013-11-14 Paul Eggert <eggert@cs.ucla.edu>
* lwlib.c (safe_strdup): Prefer tail calls.
......
......@@ -83,8 +83,8 @@ typedef struct _XlwMenu_part
int horizontal;
/* True means top_shadow_color and/or bottom_shadow_color must be freed. */
unsigned free_top_shadow_color_p : 1;
unsigned free_bottom_shadow_color_p : 1;
bool_bf free_top_shadow_color_p : 1;
bool_bf free_bottom_shadow_color_p : 1;
/* State of the XlwMenu */
int top_depth;
......
2013-12-14 Paul Eggert <eggert@cs.ucla.edu>
Use bool for boolean, focusing on headers.
* atimer.h, lisp.h, syssignal.h, syswait.h, unexelf.c:
No need to include <stdbool.h>, since conf_post.h does it now.
* buffer.h (BUF_COMPUTE_UNCHANGED, DECODE_POSITION)
(BUFFER_CHECK_INDIRECTION, GET_OVERLAYS_AT, PER_BUFFER_VALUE_P)
(SET_PER_BUFFER_VALUE_P):
* ccl.c, ccl.h (setup_ccl_program):
* ccl.h (CHECK_CCL_PROGRAM):
* character.h (MAKE_CHAR_UNIBYTE, CHECK_CHARACTER_CAR)
(CHECK_CHARACTER_CDR, CHAR_STRING_ADVANCE, NEXT_CHAR_BOUNDARY)
(PREV_CHAR_BOUNDARY, FETCH_STRING_CHAR_ADVANCE)
(FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE)
(FETCH_STRING_CHAR_ADVANCE_NO_CHECK, FETCH_CHAR_ADVANCE)
(FETCH_CHAR_ADVANCE_NO_CHECK, INC_POS, DEC_POS, INC_BOTH)
(DEC_BOTH, BUF_INC_POS, BUF_DEC_POS):
* charset.h (CHECK_CHARSET, CHECK_CHARSET_GET_ID)
(CHECK_CHARSET_GET_ATTR, CHECK_CHARSET_GET_CHARSET)
(CHARSET_FAST_MAP_SET):
* coding.c (decode_coding_ccl, encode_coding_ccl):
* coding.h (CHECK_CODING_SYSTEM, CHECK_CODING_SYSTEM_GET_SPEC)
(CHECK_CODING_SYSTEM_GET_ID, SJIS_TO_JIS, SJIS_TO_JIS2)
(JIS_TO_SJIS, JIS_TO_SJIS2, ENCODE_FILE, DECODE_FILE)
(ENCODE_SYSTEM, DECODE_SYSTEM, ENCODE_UTF_8)
(decode_coding_c_string):
* composite.h (COMPOSITION_DECODE_REFS, COMPOSITION_DECODE_RULE):
* conf_post.h (has_attribute):
* dispextern.h (trace_redisplay_p):
(INC_TEXT_POS, DEC_TEXT_POS, SET_GLYPH_FROM_GLYPH_CODE)
(SET_CHAR_GLYPH, SET_CHAR_GLYPH_FROM_GLYPH)
(SET_GLYPH_FROM_CHAR_GLYPH):
(WINDOW_WANTS_MODELINE_P, WINDOW_WANTS_HEADER_LINE_P)
(FACE_SUITABLE_FOR_ASCII_CHAR_P, FACE_SUITABLE_FOR_CHAR_P)
(PRODUCE_GLYPHS, reset_mouse_highlight, in_display_vector_p)
(cursor_in_mouse_face_p):
* dispnew.c (adjust_glyph_matrix, clear_glyph_matrix_rows)
(blank_row, prepare_desired_row)
(build_frame_matrix_from_leaf_window, make_current)
(mirror_make_current, mirrored_line_dance, mirror_line_dance)
(update_window, scrolling_window, update_frame_line):
* disptab.h (GLYPH_FOLLOW_ALIASES):
* editfns.c (Fformat):
* font.h (FONT_WEIGHT_SYMBOLIC, FONT_SLANT_SYMBOLIC)
(FONT_WIDTH_SYMBOLIC, FONT_WEIGHT_FOR_FACE, FONT_SLANT_FOR_FACE)
(FONT_WIDTH_FOR_FACE, FONT_WEIGHT_NAME_NUMERIC)
(FONT_SLANT_NAME_NUMERIC, FONT_WIDTH_NAME_NUMERIC)
(FONT_SET_STYLE, CHECK_FONT, CHECK_FONT_SPEC, CHECK_FONT_ENTITY)
(CHECK_FONT_OBJECT, CHECK_FONT_GET_OBJECT, FONT_ADD_LOG)
(FONT_DEFERRED_LOG):
* frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_WINDOW_P):
(FRAME_EXTERNAL_TOOL_BAR, FRAME_EXTERNAL_MENU_BAR, FOR_EACH_FRAME)
(FRAME_MOUSE_UPDATE):
* fringe.c (Fdefine_fringe_bitmap):
* image.c (x_create_bitmap_from_data, x_create_bitmap_mask)
(x_create_bitmap_from_xpm_data, xpm_load_image):
* intervals.h (INTERVAL_HAS_PARENT, INTERVAL_PARENT)
(set_interval_parent, RESET_INTERVAL, COPY_INTERVAL_CACHE)
(MERGE_INTERVAL_CACHE):
* keymap.h (KEYMAPP):
* lisp.h (eassert, USE_LSB_TAG, CHECK_LISP_OBJECT_TYPE)
(STRING_SET_UNIBYTE, STRING_SET_MULTIBYTE, DEFSYM, PSEUDOVECTORP)
(CHECK_RANGED_INTEGER, CHECK_TYPE_RANGED_INTEGER)
(CHECK_NUMBER_COERCE_MARKER, CHECK_NUMBER_OR_FLOAT_COERCE_MARKER)
(DEFVAR_LISP, DEFVAR_LISP_NOPRO, DEFVAR_BOOL, DEFVAR_INT)
(DEFVAR_BUFFER_DEFAULTS, DEFVAR_KBOARD, QUIT)
(RETURN_UNGCPRO, USE_SAFE_ALLOCA, SAFE_NALLOCA, SAFE_FREE)
(SAFE_ALLOCA_LISP, FOR_EACH_ALIST_VALUE, functionp):
* syntax.h (SYNTAX_ENTRY, SYNTAX_WITH_FLAGS, SYNTAX)
(UPDATE_SYNTAX_TABLE_FORWARD, UPDATE_SYNTAX_TABLE_BACKWARD)
(SETUP_BUFFER_SYNTAX_TABLE):
* systime.h (timespec_valid_p):
* term.c (save_and_enable_current_matrix):
* window.h (WINDOW_MENU_BAR_P, WINDOW_TOOL_BAR_P):
* xdisp.c (in_display_vector_p, display_tool_bar_line)
(redisplay_internal, try_window_reusing_current_matrix)
(sync_frame_with_window_matrix_rows, try_window_id)
(display_menu_bar, display_tty_menu_item, display_mode_line)
(coords_in_mouse_face_p, cursor_in_mouse_face_p):
* xmenu.c (xmenu_show):
* xterm.c (use_xim, x_term_init):
* xterm.h (XSync, GTK_CHECK_VERSION, use_xim, SET_SCROLL_BAR_X_WIDGET)
(struct x_bitmap_record):
Use bool for booleans.
* ccl.c (struct buffer_text):
* ccl.h (struct ccl_program):
* charset.h (struct charset):
* cm.h (struct cm):
* coding.h (struct iso_2022_spec, struct coding_system):
* dispextern.h (struct glyph, struct glyph_matrix, struct glyph_row)
(struct glyph_string, struct face, struct face_cache)
(struct bidi_string_data, struct bidi_it)
(struct draw_fringe_bitmap_params, struct it, Mouse_HLInfo)
(struct image):
* editfns.c (Fformat):
* frame.h (struct frame):
* fringe.c (struct fringe_bitmap):