Commit f75d7a91 authored by Paul Eggert's avatar Paul Eggert

* fileio.c, filelock.c, floatfns.c, fns.c: Use bool for boolean.

* fileio.c (auto_saving, auto_save_error_occurred, make_temp_name)
(Fexpand_file_name, barf_or_query_if_file_exists, Fcopy_file)
(file_name_absolute_p, Fsubstitute_in_file_name):
(check_executable, check_writable, Ffile_accessible_directory_p)
(Fset_file_selinux_context, Fdefault_file_modes)
(Finsert_file_contents, choose_write_coding_system)
(Fwrite_region, build_annotations, a_write, e_write)
(Fdo_auto_save):
* filelock.c (boot_time_initialized, get_boot_time)
(get_boot_time_1, lock_file_1, within_one_second):
* floatfns.c (in_float):
* fns.c (concat, internal_equal, Frequire, base64_encode_1)
(base64_decode_1, cmpfn_eql, cmpfn_user_defined)
(sweep_weak_table, sweep_weak_hash_tables, secure_hash):
* lisp.h (struct Lisp_Hash_Table.cmpfn):
* window.c (compare_window_configurations):
Use bool for booleans.
* fileio.c (auto_saving_dir_umask, auto_saving_mode_bits)
(Fdefault_file_modes): Now mode_t, not int, for modes.
(Fdo_auto_save): Set a boolean to 1 rather than using ++.
(internal_delete_file): Now returns void, not a (boolean) int,
since nobody was looking at the return value.
* lisp.h, window.h: Adjust to above API changes.
parent 7e570fbf
2012-09-05 Paul Eggert <eggert@cs.ucla.edu>
* fileio.c, filelock.c, floatfns.c, fns.c: Use bool for boolean.
* fileio.c (auto_saving, auto_save_error_occurred, make_temp_name)
(Fexpand_file_name, barf_or_query_if_file_exists, Fcopy_file)
(file_name_absolute_p, Fsubstitute_in_file_name):
(check_executable, check_writable, Ffile_accessible_directory_p)
(Fset_file_selinux_context, Fdefault_file_modes)
(Finsert_file_contents, choose_write_coding_system)
(Fwrite_region, build_annotations, a_write, e_write)
(Fdo_auto_save):
* filelock.c (boot_time_initialized, get_boot_time)
(get_boot_time_1, lock_file_1, within_one_second):
* floatfns.c (in_float):
* fns.c (concat, internal_equal, Frequire, base64_encode_1)
(base64_decode_1, cmpfn_eql, cmpfn_user_defined)
(sweep_weak_table, sweep_weak_hash_tables, secure_hash):
* lisp.h (struct Lisp_Hash_Table.cmpfn):
* window.c (compare_window_configurations):
Use bool for booleans.
* fileio.c (auto_saving_dir_umask, auto_saving_mode_bits)
(Fdefault_file_modes): Now mode_t, not int, for modes.
(Fdo_auto_save): Set a boolean to 1 rather than using ++.
(internal_delete_file): Now returns void, not a (boolean) int,
since nobody was looking at the return value.
* lisp.h, window.h: Adjust to above API changes.
* xdisp.c (set_message): Simplify and reindent last change.
2012-09-05 Juanma Barranquero <lekktu@gmail.com>
......
This diff is collapsed.
......@@ -100,10 +100,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
/* Return the time of the last system boot. */
static time_t boot_time;
static int boot_time_initialized;
static bool boot_time_initialized;
#ifdef BOOT_TIME
static void get_boot_time_1 (const char *, int);
static void get_boot_time_1 (const char *, bool);
#endif
static time_t
......@@ -170,7 +170,7 @@ get_boot_time (void)
{
char cmd_string[sizeof WTMP_FILE ".19.gz"];
Lisp_Object tempname, filename;
int delete_flag = 0;
bool delete_flag = 0;
filename = Qnil;
......@@ -225,13 +225,13 @@ get_boot_time (void)
If FILENAME is zero, use the same file as before;
if no FILENAME has ever been specified, this is the utmp file.
Use the newest reboot record if NEWEST is nonzero,
Use the newest reboot record if NEWEST,
the first reboot record otherwise.
Ignore all reboot records on or before BOOT_TIME.
Success is indicated by setting BOOT_TIME to a larger value. */
void
get_boot_time_1 (const char *filename, int newest)
get_boot_time_1 (const char *filename, bool newest)
{
struct utmp ut, *utp;
int desc;
......@@ -331,11 +331,11 @@ fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
}
/* Lock the lock file named LFNAME.
If FORCE is nonzero, we do so even if it is already locked.
Return 1 if successful, 0 if not. */
If FORCE, do so even if it is already locked.
Return true if successful. */
static int
lock_file_1 (char *lfname, int force)
static bool
lock_file_1 (char *lfname, bool force)
{
int err;
int symlink_errno;
......@@ -370,9 +370,9 @@ lock_file_1 (char *lfname, int force)
return err == 0;
}
/* Return 1 if times A and B are no more than one second apart. */
/* Return true if times A and B are no more than one second apart. */
static int
static bool
within_one_second (time_t a, time_t b)
{
return (a - b >= -1 && a - b <= 1);
......@@ -491,7 +491,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
static int
lock_if_free (lock_info_type *clasher, register char *lfname)
{
while (lock_file_1 (lfname, 0) == 0)
while (! lock_file_1 (lfname, 0))
{
int locker;
......
......@@ -103,10 +103,10 @@ extern double logb (double);
static void float_error ();
#endif
/* Nonzero while executing in floating point.
/* True while executing in floating point.
This tells float_error what to do. */
static int in_float;
static bool in_float;
/* If an argument is out of range for a mathematical function,
here is the actual argument value to use in the error message.
......
......@@ -51,7 +51,7 @@ static Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512;
static int internal_equal (Lisp_Object , Lisp_Object, int, int);
static bool internal_equal (Lisp_Object, Lisp_Object, int, bool);
DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
doc: /* Return the argument unchanged. */)
......@@ -352,7 +352,7 @@ Symbols are also allowed; their print names are used instead. */)
}
static Lisp_Object concat (ptrdiff_t nargs, Lisp_Object *args,
enum Lisp_Type target_type, int last_special);
enum Lisp_Type target_type, bool last_special);
/* ARGSUSED */
Lisp_Object
......@@ -450,19 +450,19 @@ struct textprop_rec
static Lisp_Object
concat (ptrdiff_t nargs, Lisp_Object *args,
enum Lisp_Type target_type, int last_special)
enum Lisp_Type target_type, bool last_special)
{
Lisp_Object val;
register Lisp_Object tail;
register Lisp_Object this;
Lisp_Object tail;
Lisp_Object this;
ptrdiff_t toindex;
ptrdiff_t toindex_byte = 0;
register EMACS_INT result_len;
register EMACS_INT result_len_byte;
EMACS_INT result_len;
EMACS_INT result_len_byte;
ptrdiff_t argnum;
Lisp_Object last_tail;
Lisp_Object prev;
int some_multibyte;
bool some_multibyte;
/* When we make a multibyte string, we can't copy text properties
while concatenating each string because the length of resulting
string can't be decided until we finish the whole concatenation.
......@@ -1988,10 +1988,10 @@ of strings. (`equal' ignores text properties.) */)
/* DEPTH is current depth of recursion. Signal an error if it
gets too deep.
PROPS, if non-nil, means compare string text properties too. */
PROPS means compare string text properties too. */
static int
internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int props)
static bool
internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props)
{
if (depth > 200)
error ("Stack overflow in equal");
......@@ -2589,9 +2589,9 @@ Normally the return value is FEATURE.
The normal messages at start and end of loading FILENAME are suppressed. */)
(Lisp_Object feature, Lisp_Object filename, Lisp_Object noerror)
{
register Lisp_Object tem;
Lisp_Object tem;
struct gcpro gcpro1, gcpro2;
int from_file = load_in_progress;
bool from_file = load_in_progress;
CHECK_SYMBOL (feature);
......@@ -2917,8 +2917,8 @@ static const short base64_char_to_value[128] =
base64 characters. */
static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, int, int);
static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, int,
static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, bool, bool);
static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, bool,
ptrdiff_t *);
DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region,
......@@ -3026,7 +3026,7 @@ into shorter lines. */)
static ptrdiff_t
base64_encode_1 (const char *from, char *to, ptrdiff_t length,
int line_break, int multibyte)
bool line_break, bool multibyte)
{
int counter = 0;
ptrdiff_t i = 0;
......@@ -3133,7 +3133,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */
ptrdiff_t old_pos = PT;
ptrdiff_t decoded_length;
ptrdiff_t inserted_chars;
int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
USE_SAFE_ALLOCA;
validate_region (&beg, &end);
......@@ -3218,13 +3218,13 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
}
/* Base64-decode the data at FROM of LENGTH bytes into TO. If
MULTIBYTE is nonzero, the decoded result should be in multibyte
MULTIBYTE, the decoded result should be in multibyte
form. If NCHARS_RETURN is not NULL, store the number of produced
characters in *NCHARS_RETURN. */
static ptrdiff_t
base64_decode_1 (const char *from, char *to, ptrdiff_t length,
int multibyte, ptrdiff_t *nchars_return)
bool multibyte, ptrdiff_t *nchars_return)
{
ptrdiff_t i = 0; /* Used inside READ_QUADRUPLET_BYTE */
char *e = to;
......@@ -3340,7 +3340,7 @@ static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
static struct Lisp_Hash_Table *check_hash_table (Lisp_Object);
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);
static bool sweep_weak_table (struct Lisp_Hash_Table *, bool);
......@@ -3432,10 +3432,10 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max)
***********************************************************************/
/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code
HASH2 in hash table H using `eql'. Value is non-zero if KEY1 and
HASH2 in hash table H using `eql'. Value is true if KEY1 and
KEY2 are the same. */
static int
static bool
cmpfn_eql (struct Lisp_Hash_Table *h,
Lisp_Object key1, EMACS_UINT hash1,
Lisp_Object key2, EMACS_UINT hash2)
......@@ -3447,10 +3447,10 @@ cmpfn_eql (struct Lisp_Hash_Table *h,
/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code
HASH2 in hash table H using `equal'. Value is non-zero if KEY1 and
HASH2 in hash table H using `equal'. Value is true if KEY1 and
KEY2 are the same. */
static int
static bool
cmpfn_equal (struct Lisp_Hash_Table *h,
Lisp_Object key1, EMACS_UINT hash1,
Lisp_Object key2, EMACS_UINT hash2)
......@@ -3460,10 +3460,10 @@ cmpfn_equal (struct Lisp_Hash_Table *h,
/* Compare KEY1 which has hash code HASH1, and KEY2 with hash code
HASH2 in hash table H using H->user_cmp_function. Value is non-zero
HASH2 in hash table H using H->user_cmp_function. Value is true
if KEY1 and KEY2 are the same. */
static int
static bool
cmpfn_user_defined (struct Lisp_Hash_Table *h,
Lisp_Object key1, EMACS_UINT hash1,
Lisp_Object key2, EMACS_UINT hash2)
......@@ -3923,16 +3923,16 @@ hash_clear (struct Lisp_Hash_Table *h)
Weak Hash Tables
************************************************************************/
/* Sweep weak hash table H. REMOVE_ENTRIES_P non-zero means remove
/* Sweep weak hash table H. REMOVE_ENTRIES_P means remove
entries from the table that don't survive the current GC.
REMOVE_ENTRIES_P zero means mark entries that are in use. Value is
non-zero if anything was marked. */
!REMOVE_ENTRIES_P means mark entries that are in use. Value is
true if anything was marked. */
static int
sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
static bool
sweep_weak_table (struct Lisp_Hash_Table *h, bool remove_entries_p)
{
ptrdiff_t bucket, n;
int marked;
bool marked;
n = ASIZE (h->index) & ~ARRAY_MARK_FLAG;
marked = 0;
......@@ -3949,7 +3949,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
ptrdiff_t i = XFASTINT (idx);
bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
int remove_p;
bool remove_p;
if (EQ (h->weak, Qkey))
remove_p = !key_known_to_survive_p;
......@@ -4022,7 +4022,7 @@ void
sweep_weak_hash_tables (void)
{
struct Lisp_Hash_Table *h, *used, *next;
int marked;
bool marked;
/* Mark all keys and values that are in use. Keep on marking until
there is no more change. This is necessary for cases like
......@@ -4674,7 +4674,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
coding_system = Vcoding_system_for_write;
else
{
int force_raw_text = 0;
bool force_raw_text = 0;
coding_system = BVAR (XBUFFER (object), buffer_file_coding_system);
if (NILP (coding_system)
......
......@@ -1205,9 +1205,9 @@ struct Lisp_Hash_Table
struct Lisp_Hash_Table *next_weak;
/* C function to compare two keys. */
int (*cmpfn) (struct Lisp_Hash_Table *,
Lisp_Object, EMACS_UINT,
Lisp_Object, EMACS_UINT);
bool (*cmpfn) (struct Lisp_Hash_Table *,
Lisp_Object, EMACS_UINT,
Lisp_Object, EMACS_UINT);
/* C function to compute hash code. */
EMACS_UINT (*hashfn) (struct Lisp_Hash_Table *, Lisp_Object);
......@@ -3151,9 +3151,9 @@ EXFUN (Fread_file_name, 6); /* not a normal DEFUN */
extern Lisp_Object close_file_unwind (Lisp_Object);
extern Lisp_Object restore_point_unwind (Lisp_Object);
extern _Noreturn void report_file_error (const char *, Lisp_Object);
extern int internal_delete_file (Lisp_Object);
extern void internal_delete_file (Lisp_Object);
extern void syms_of_fileio (void);
extern Lisp_Object make_temp_name (Lisp_Object, int);
extern Lisp_Object make_temp_name (Lisp_Object, bool);
extern Lisp_Object Qdelete_file;
/* Defined in search.c */
......
......@@ -6576,15 +6576,17 @@ freeze_window_starts (struct frame *f, int freeze_p)
/* Return 1 if window configurations CONFIGURATION1 and CONFIGURATION2
describe the same state of affairs. This is used by Fequal.
ignore_positions non-zero means ignore non-matching scroll positions
IGNORE_POSITIONS means ignore non-matching scroll positions
and the like.
This ignores a couple of things like the dedication status of
window, combination_limit and the like. This might have to be
fixed. */
int
compare_window_configurations (Lisp_Object configuration1, Lisp_Object configuration2, int ignore_positions)
bool
compare_window_configurations (Lisp_Object configuration1,
Lisp_Object configuration2,
bool ignore_positions)
{
register struct save_window_data *d1, *d2;
struct Lisp_Vector *sws1, *sws2;
......
......@@ -973,7 +973,7 @@ extern Lisp_Object Qwindowp, Qwindow_live_p;
extern Lisp_Object Vwindow_list;
extern struct window *decode_live_window (Lisp_Object);
extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool);
extern void mark_window_cursors_off (struct window *);
extern int window_internal_height (struct window *);
extern int window_body_cols (struct window *w);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment