aboutsummaryrefslogtreecommitdiffstats
path: root/src/fns.c
diff options
context:
space:
mode:
authorPaul Eggert2012-09-05 00:18:46 -0700
committerPaul Eggert2012-09-05 00:18:46 -0700
commitf75d7a913dd0fae7a739d12f704fca024c065c3e (patch)
tree5f7d36acdd831dcc0f377f39866bb33804ce741a /src/fns.c
parent7e570fbf3ef8ccd31df2651f5d2775c5697d5950 (diff)
downloademacs-f75d7a913dd0fae7a739d12f704fca024c065c3e.tar.gz
emacs-f75d7a913dd0fae7a739d12f704fca024c065c3e.zip
* 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.
Diffstat (limited to 'src/fns.c')
-rw-r--r--src/fns.c70
1 files changed, 35 insertions, 35 deletions
diff --git a/src/fns.c b/src/fns.c
index fc0044106cd..20770af67d4 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -51,7 +51,7 @@ static Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
51 51
52static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512; 52static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512;
53 53
54static int internal_equal (Lisp_Object , Lisp_Object, int, int); 54static bool internal_equal (Lisp_Object, Lisp_Object, int, bool);
55 55
56DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, 56DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
57 doc: /* Return the argument unchanged. */) 57 doc: /* Return the argument unchanged. */)
@@ -352,7 +352,7 @@ Symbols are also allowed; their print names are used instead. */)
352} 352}
353 353
354static Lisp_Object concat (ptrdiff_t nargs, Lisp_Object *args, 354static Lisp_Object concat (ptrdiff_t nargs, Lisp_Object *args,
355 enum Lisp_Type target_type, int last_special); 355 enum Lisp_Type target_type, bool last_special);
356 356
357/* ARGSUSED */ 357/* ARGSUSED */
358Lisp_Object 358Lisp_Object
@@ -450,19 +450,19 @@ struct textprop_rec
450 450
451static Lisp_Object 451static Lisp_Object
452concat (ptrdiff_t nargs, Lisp_Object *args, 452concat (ptrdiff_t nargs, Lisp_Object *args,
453 enum Lisp_Type target_type, int last_special) 453 enum Lisp_Type target_type, bool last_special)
454{ 454{
455 Lisp_Object val; 455 Lisp_Object val;
456 register Lisp_Object tail; 456 Lisp_Object tail;
457 register Lisp_Object this; 457 Lisp_Object this;
458 ptrdiff_t toindex; 458 ptrdiff_t toindex;
459 ptrdiff_t toindex_byte = 0; 459 ptrdiff_t toindex_byte = 0;
460 register EMACS_INT result_len; 460 EMACS_INT result_len;
461 register EMACS_INT result_len_byte; 461 EMACS_INT result_len_byte;
462 ptrdiff_t argnum; 462 ptrdiff_t argnum;
463 Lisp_Object last_tail; 463 Lisp_Object last_tail;
464 Lisp_Object prev; 464 Lisp_Object prev;
465 int some_multibyte; 465 bool some_multibyte;
466 /* When we make a multibyte string, we can't copy text properties 466 /* When we make a multibyte string, we can't copy text properties
467 while concatenating each string because the length of resulting 467 while concatenating each string because the length of resulting
468 string can't be decided until we finish the whole concatenation. 468 string can't be decided until we finish the whole concatenation.
@@ -1988,10 +1988,10 @@ of strings. (`equal' ignores text properties.) */)
1988 1988
1989/* DEPTH is current depth of recursion. Signal an error if it 1989/* DEPTH is current depth of recursion. Signal an error if it
1990 gets too deep. 1990 gets too deep.
1991 PROPS, if non-nil, means compare string text properties too. */ 1991 PROPS means compare string text properties too. */
1992 1992
1993static int 1993static bool
1994internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int props) 1994internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props)
1995{ 1995{
1996 if (depth > 200) 1996 if (depth > 200)
1997 error ("Stack overflow in equal"); 1997 error ("Stack overflow in equal");
@@ -2589,9 +2589,9 @@ Normally the return value is FEATURE.
2589The normal messages at start and end of loading FILENAME are suppressed. */) 2589The normal messages at start and end of loading FILENAME are suppressed. */)
2590 (Lisp_Object feature, Lisp_Object filename, Lisp_Object noerror) 2590 (Lisp_Object feature, Lisp_Object filename, Lisp_Object noerror)
2591{ 2591{
2592 register Lisp_Object tem; 2592 Lisp_Object tem;
2593 struct gcpro gcpro1, gcpro2; 2593 struct gcpro gcpro1, gcpro2;
2594 int from_file = load_in_progress; 2594 bool from_file = load_in_progress;
2595 2595
2596 CHECK_SYMBOL (feature); 2596 CHECK_SYMBOL (feature);
2597 2597
@@ -2917,8 +2917,8 @@ static const short base64_char_to_value[128] =
2917 base64 characters. */ 2917 base64 characters. */
2918 2918
2919 2919
2920static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, int, int); 2920static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, bool, bool);
2921static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, int, 2921static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, bool,
2922 ptrdiff_t *); 2922 ptrdiff_t *);
2923 2923
2924DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region, 2924DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region,
@@ -3026,7 +3026,7 @@ into shorter lines. */)
3026 3026
3027static ptrdiff_t 3027static ptrdiff_t
3028base64_encode_1 (const char *from, char *to, ptrdiff_t length, 3028base64_encode_1 (const char *from, char *to, ptrdiff_t length,
3029 int line_break, int multibyte) 3029 bool line_break, bool multibyte)
3030{ 3030{
3031 int counter = 0; 3031 int counter = 0;
3032 ptrdiff_t i = 0; 3032 ptrdiff_t i = 0;
@@ -3133,7 +3133,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */
3133 ptrdiff_t old_pos = PT; 3133 ptrdiff_t old_pos = PT;
3134 ptrdiff_t decoded_length; 3134 ptrdiff_t decoded_length;
3135 ptrdiff_t inserted_chars; 3135 ptrdiff_t inserted_chars;
3136 int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); 3136 bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
3137 USE_SAFE_ALLOCA; 3137 USE_SAFE_ALLOCA;
3138 3138
3139 validate_region (&beg, &end); 3139 validate_region (&beg, &end);
@@ -3218,13 +3218,13 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string,
3218} 3218}
3219 3219
3220/* Base64-decode the data at FROM of LENGTH bytes into TO. If 3220/* Base64-decode the data at FROM of LENGTH bytes into TO. If
3221 MULTIBYTE is nonzero, the decoded result should be in multibyte 3221 MULTIBYTE, the decoded result should be in multibyte
3222 form. If NCHARS_RETURN is not NULL, store the number of produced 3222 form. If NCHARS_RETURN is not NULL, store the number of produced
3223 characters in *NCHARS_RETURN. */ 3223 characters in *NCHARS_RETURN. */
3224 3224
3225static ptrdiff_t 3225static ptrdiff_t
3226base64_decode_1 (const char *from, char *to, ptrdiff_t length, 3226base64_decode_1 (const char *from, char *to, ptrdiff_t length,
3227 int multibyte, ptrdiff_t *nchars_return) 3227 bool multibyte, ptrdiff_t *nchars_return)
3228{ 3228{
3229 ptrdiff_t i = 0; /* Used inside READ_QUADRUPLET_BYTE */ 3229 ptrdiff_t i = 0; /* Used inside READ_QUADRUPLET_BYTE */
3230 char *e = to; 3230 char *e = to;
@@ -3340,7 +3340,7 @@ static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value;
3340static struct Lisp_Hash_Table *check_hash_table (Lisp_Object); 3340static struct Lisp_Hash_Table *check_hash_table (Lisp_Object);
3341static ptrdiff_t get_key_arg (Lisp_Object, ptrdiff_t, Lisp_Object *, char *); 3341static ptrdiff_t get_key_arg (Lisp_Object, ptrdiff_t, Lisp_Object *, char *);
3342static void maybe_resize_hash_table (struct Lisp_Hash_Table *); 3342static void maybe_resize_hash_table (struct Lisp_Hash_Table *);
3343static int sweep_weak_table (struct Lisp_Hash_Table *, int); 3343static bool sweep_weak_table (struct Lisp_Hash_Table *, bool);
3344 3344
3345 3345
3346 3346
@@ -3432,10 +3432,10 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max)
3432 ***********************************************************************/ 3432 ***********************************************************************/
3433 3433
3434/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code 3434/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code
3435 HASH2 in hash table H using `eql'. Value is non-zero if KEY1 and 3435 HASH2 in hash table H using `eql'. Value is true if KEY1 and
3436 KEY2 are the same. */ 3436 KEY2 are the same. */
3437 3437
3438static int 3438static bool
3439cmpfn_eql (struct Lisp_Hash_Table *h, 3439cmpfn_eql (struct Lisp_Hash_Table *h,
3440 Lisp_Object key1, EMACS_UINT hash1, 3440 Lisp_Object key1, EMACS_UINT hash1,
3441 Lisp_Object key2, EMACS_UINT hash2) 3441 Lisp_Object key2, EMACS_UINT hash2)
@@ -3447,10 +3447,10 @@ cmpfn_eql (struct Lisp_Hash_Table *h,
3447 3447
3448 3448
3449/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code 3449/* Compare KEY1 which has hash code HASH1 and KEY2 with hash code
3450 HASH2 in hash table H using `equal'. Value is non-zero if KEY1 and 3450 HASH2 in hash table H using `equal'. Value is true if KEY1 and
3451 KEY2 are the same. */ 3451 KEY2 are the same. */
3452 3452
3453static int 3453static bool
3454cmpfn_equal (struct Lisp_Hash_Table *h, 3454cmpfn_equal (struct Lisp_Hash_Table *h,
3455 Lisp_Object key1, EMACS_UINT hash1, 3455 Lisp_Object key1, EMACS_UINT hash1,
3456 Lisp_Object key2, EMACS_UINT hash2) 3456 Lisp_Object key2, EMACS_UINT hash2)
@@ -3460,10 +3460,10 @@ cmpfn_equal (struct Lisp_Hash_Table *h,
3460 3460
3461 3461
3462/* Compare KEY1 which has hash code HASH1, and KEY2 with hash code 3462/* Compare KEY1 which has hash code HASH1, and KEY2 with hash code
3463 HASH2 in hash table H using H->user_cmp_function. Value is non-zero 3463 HASH2 in hash table H using H->user_cmp_function. Value is true
3464 if KEY1 and KEY2 are the same. */ 3464 if KEY1 and KEY2 are the same. */
3465 3465
3466static int 3466static bool
3467cmpfn_user_defined (struct Lisp_Hash_Table *h, 3467cmpfn_user_defined (struct Lisp_Hash_Table *h,
3468 Lisp_Object key1, EMACS_UINT hash1, 3468 Lisp_Object key1, EMACS_UINT hash1,
3469 Lisp_Object key2, EMACS_UINT hash2) 3469 Lisp_Object key2, EMACS_UINT hash2)
@@ -3923,16 +3923,16 @@ hash_clear (struct Lisp_Hash_Table *h)
3923 Weak Hash Tables 3923 Weak Hash Tables
3924 ************************************************************************/ 3924 ************************************************************************/
3925 3925
3926/* Sweep weak hash table H. REMOVE_ENTRIES_P non-zero means remove 3926/* Sweep weak hash table H. REMOVE_ENTRIES_P means remove
3927 entries from the table that don't survive the current GC. 3927 entries from the table that don't survive the current GC.
3928 REMOVE_ENTRIES_P zero means mark entries that are in use. Value is 3928 !REMOVE_ENTRIES_P means mark entries that are in use. Value is
3929 non-zero if anything was marked. */ 3929 true if anything was marked. */
3930 3930
3931static int 3931static bool
3932sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) 3932sweep_weak_table (struct Lisp_Hash_Table *h, bool remove_entries_p)
3933{ 3933{
3934 ptrdiff_t bucket, n; 3934 ptrdiff_t bucket, n;
3935 int marked; 3935 bool marked;
3936 3936
3937 n = ASIZE (h->index) & ~ARRAY_MARK_FLAG; 3937 n = ASIZE (h->index) & ~ARRAY_MARK_FLAG;
3938 marked = 0; 3938 marked = 0;
@@ -3949,7 +3949,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p)
3949 ptrdiff_t i = XFASTINT (idx); 3949 ptrdiff_t i = XFASTINT (idx);
3950 bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); 3950 bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i));
3951 bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); 3951 bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i));
3952 int remove_p; 3952 bool remove_p;
3953 3953
3954 if (EQ (h->weak, Qkey)) 3954 if (EQ (h->weak, Qkey))
3955 remove_p = !key_known_to_survive_p; 3955 remove_p = !key_known_to_survive_p;
@@ -4022,7 +4022,7 @@ void
4022sweep_weak_hash_tables (void) 4022sweep_weak_hash_tables (void)
4023{ 4023{
4024 struct Lisp_Hash_Table *h, *used, *next; 4024 struct Lisp_Hash_Table *h, *used, *next;
4025 int marked; 4025 bool marked;
4026 4026
4027 /* Mark all keys and values that are in use. Keep on marking until 4027 /* Mark all keys and values that are in use. Keep on marking until
4028 there is no more change. This is necessary for cases like 4028 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_
4674 coding_system = Vcoding_system_for_write; 4674 coding_system = Vcoding_system_for_write;
4675 else 4675 else
4676 { 4676 {
4677 int force_raw_text = 0; 4677 bool force_raw_text = 0;
4678 4678
4679 coding_system = BVAR (XBUFFER (object), buffer_file_coding_system); 4679 coding_system = BVAR (XBUFFER (object), buffer_file_coding_system);
4680 if (NILP (coding_system) 4680 if (NILP (coding_system)