aboutsummaryrefslogtreecommitdiffstats
path: root/src/filelock.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/filelock.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/filelock.c')
-rw-r--r--src/filelock.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/filelock.c b/src/filelock.c
index d21d8e7ba02..1f599c68912 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -100,10 +100,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
100/* Return the time of the last system boot. */ 100/* Return the time of the last system boot. */
101 101
102static time_t boot_time; 102static time_t boot_time;
103static int boot_time_initialized; 103static bool boot_time_initialized;
104 104
105#ifdef BOOT_TIME 105#ifdef BOOT_TIME
106static void get_boot_time_1 (const char *, int); 106static void get_boot_time_1 (const char *, bool);
107#endif 107#endif
108 108
109static time_t 109static time_t
@@ -170,7 +170,7 @@ get_boot_time (void)
170 { 170 {
171 char cmd_string[sizeof WTMP_FILE ".19.gz"]; 171 char cmd_string[sizeof WTMP_FILE ".19.gz"];
172 Lisp_Object tempname, filename; 172 Lisp_Object tempname, filename;
173 int delete_flag = 0; 173 bool delete_flag = 0;
174 174
175 filename = Qnil; 175 filename = Qnil;
176 176
@@ -225,13 +225,13 @@ get_boot_time (void)
225 225
226 If FILENAME is zero, use the same file as before; 226 If FILENAME is zero, use the same file as before;
227 if no FILENAME has ever been specified, this is the utmp file. 227 if no FILENAME has ever been specified, this is the utmp file.
228 Use the newest reboot record if NEWEST is nonzero, 228 Use the newest reboot record if NEWEST,
229 the first reboot record otherwise. 229 the first reboot record otherwise.
230 Ignore all reboot records on or before BOOT_TIME. 230 Ignore all reboot records on or before BOOT_TIME.
231 Success is indicated by setting BOOT_TIME to a larger value. */ 231 Success is indicated by setting BOOT_TIME to a larger value. */
232 232
233void 233void
234get_boot_time_1 (const char *filename, int newest) 234get_boot_time_1 (const char *filename, bool newest)
235{ 235{
236 struct utmp ut, *utp; 236 struct utmp ut, *utp;
237 int desc; 237 int desc;
@@ -331,11 +331,11 @@ fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
331} 331}
332 332
333/* Lock the lock file named LFNAME. 333/* Lock the lock file named LFNAME.
334 If FORCE is nonzero, we do so even if it is already locked. 334 If FORCE, do so even if it is already locked.
335 Return 1 if successful, 0 if not. */ 335 Return true if successful. */
336 336
337static int 337static bool
338lock_file_1 (char *lfname, int force) 338lock_file_1 (char *lfname, bool force)
339{ 339{
340 int err; 340 int err;
341 int symlink_errno; 341 int symlink_errno;
@@ -370,9 +370,9 @@ lock_file_1 (char *lfname, int force)
370 return err == 0; 370 return err == 0;
371} 371}
372 372
373/* Return 1 if times A and B are no more than one second apart. */ 373/* Return true if times A and B are no more than one second apart. */
374 374
375static int 375static bool
376within_one_second (time_t a, time_t b) 376within_one_second (time_t a, time_t b)
377{ 377{
378 return (a - b >= -1 && a - b <= 1); 378 return (a - b >= -1 && a - b <= 1);
@@ -491,7 +491,7 @@ current_lock_owner (lock_info_type *owner, char *lfname)
491static int 491static int
492lock_if_free (lock_info_type *clasher, register char *lfname) 492lock_if_free (lock_info_type *clasher, register char *lfname)
493{ 493{
494 while (lock_file_1 (lfname, 0) == 0) 494 while (! lock_file_1 (lfname, 0))
495 { 495 {
496 int locker; 496 int locker;
497 497