X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/8dc1adf681df162bfd305debef0e1ab31bed3ebd..72af86bd8cf1812d1fcc8924c4093d692040a664:/src/filelock.c diff --git a/src/filelock.c b/src/filelock.c index 7c69ea954f..769e5aa7a9 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -47,9 +47,6 @@ along with GNU Emacs. If not, see . */ #endif /* __FreeBSD__ */ #include -#ifndef errno -extern int errno; -#endif #include "lisp.h" #include "buffer.h" @@ -125,11 +122,11 @@ static int boot_time_initialized; extern Lisp_Object Vshell_file_name; #ifdef BOOT_TIME -static void get_boot_time_1 P_ ((char *, int)); +static void get_boot_time_1 (char *, int); #endif static time_t -get_boot_time () +get_boot_time (void) { #if defined (BOOT_TIME) int counter; @@ -256,9 +253,7 @@ get_boot_time () Success is indicated by setting BOOT_TIME to a larger value. */ void -get_boot_time_1 (filename, newest) - char *filename; - int newest; +get_boot_time_1 (char *filename, int newest) { struct utmp ut, *utp; int desc; @@ -329,9 +324,7 @@ typedef struct fill_in_lock_file_name (lock, (file))) static void -fill_in_lock_file_name (lockfile, fn) - register char *lockfile; - register Lisp_Object fn; +fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn) { register char *p; struct stat st; @@ -367,9 +360,7 @@ fill_in_lock_file_name (lockfile, fn) Return 1 if successful, 0 if not. */ static int -lock_file_1 (lfname, force) - char *lfname; - int force; +lock_file_1 (char *lfname, int force) { register int err; time_t boot_time; @@ -411,8 +402,7 @@ lock_file_1 (lfname, force) /* Return 1 if times A and B are no more than one second apart. */ int -within_one_second (a, b) - time_t a, b; +within_one_second (time_t a, time_t b) { return (a - b >= -1 && a - b <= 1); } @@ -423,12 +413,10 @@ within_one_second (a, b) or -1 if something is wrong with the locking mechanism. */ static int -current_lock_owner (owner, lfname) - lock_info_type *owner; - char *lfname; +current_lock_owner (lock_info_type *owner, char *lfname) { #ifndef index - extern char *rindex (), *index (); + extern char *rindex (const char *, int), *index (const char *, int); #endif int len, ret; int local_owner = 0; @@ -543,9 +531,7 @@ current_lock_owner (owner, lfname) Return -1 if cannot lock for any other reason. */ static int -lock_if_free (clasher, lfname) - lock_info_type *clasher; - register char *lfname; +lock_if_free (lock_info_type *clasher, register char *lfname) { while (lock_file_1 (lfname, 0) == 0) { @@ -588,8 +574,7 @@ lock_if_free (clasher, lfname) take away the lock, or return nil meaning ignore the lock. */ void -lock_file (fn) - Lisp_Object fn; +lock_file (Lisp_Object fn) { register Lisp_Object attack, orig_fn, encoded_fn; register char *lfname, *locker; @@ -648,8 +633,7 @@ lock_file (fn) } void -unlock_file (fn) - register Lisp_Object fn; +unlock_file (register Lisp_Object fn) { register char *lfname; @@ -663,7 +647,7 @@ unlock_file (fn) } void -unlock_all_files () +unlock_all_files (void) { register Lisp_Object tail; register struct buffer *b; @@ -712,8 +696,7 @@ should not be locked in that case. */) /* Unlock the file visited in buffer BUFFER. */ void -unlock_buffer (buffer) - struct buffer *buffer; +unlock_buffer (struct buffer *buffer) { if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer) && STRINGP (buffer->file_truename)) @@ -753,14 +736,14 @@ t if it is locked by you, else a string saying which user has locked it. */) /* Initialization functions. */ void -init_filelock () +init_filelock (void) { boot_time = 0; boot_time_initialized = 0; } void -syms_of_filelock () +syms_of_filelock (void) { DEFVAR_LISP ("temporary-file-directory", &Vtemporary_file_directory, doc: /* The directory for writing temporary files. */);