aboutsummaryrefslogtreecommitdiffstats
path: root/src/filelock.c
diff options
context:
space:
mode:
authorDan Nicolaescu2010-07-04 00:50:25 -0700
committerDan Nicolaescu2010-07-04 00:50:25 -0700
commit971de7fb158335fbda39525feb2d7776a26bc030 (patch)
tree605333d85f16e35bb06baffcb66ac49f4ec0dce9 /src/filelock.c
parentb8463cbfbe2c5183cf40772df2746e58b787ddeb (diff)
downloademacs-971de7fb158335fbda39525feb2d7776a26bc030.tar.gz
emacs-971de7fb158335fbda39525feb2d7776a26bc030.zip
Convert (most) functions in src to standard C.
* src/alloc.c: Convert function definitions to standard C. * src/atimer.c: * src/bidi.c: * src/bytecode.c: * src/callint.c: * src/callproc.c: * src/casefiddle.c: * src/casetab.c: * src/category.c: * src/ccl.c: * src/character.c: * src/charset.c: * src/chartab.c: * src/cmds.c: * src/coding.c: * src/composite.c: * src/data.c: * src/dbusbind.c: * src/dired.c: * src/dispnew.c: * src/doc.c: * src/doprnt.c: * src/ecrt0.c: * src/editfns.c: * src/fileio.c: * src/filelock.c: * src/filemode.c: * src/fns.c: * src/font.c: * src/fontset.c: * src/frame.c: * src/fringe.c: * src/ftfont.c: * src/ftxfont.c: * src/gtkutil.c: * src/indent.c: * src/insdel.c: * src/intervals.c: * src/keymap.c: * src/lread.c: * src/macros.c: * src/marker.c: * src/md5.c: * src/menu.c: * src/minibuf.c: * src/prefix-args.c: * src/print.c: * src/ralloc.c: * src/regex.c: * src/region-cache.c: * src/scroll.c: * src/search.c: * src/sound.c: * src/strftime.c: * src/syntax.c: * src/sysdep.c: * src/termcap.c: * src/terminal.c: * src/terminfo.c: * src/textprop.c: * src/tparam.c: * src/undo.c: * src/unexelf.c: * src/window.c: * src/xfaces.c: * src/xfns.c: * src/xfont.c: * src/xftfont.c: * src/xgselect.c: * src/xmenu.c: * src/xrdb.c: * src/xselect.c: * src/xsettings.c: * src/xsmfns.c: * src/xterm.c: Likewise.
Diffstat (limited to 'src/filelock.c')
-rw-r--r--src/filelock.c42
1 files changed, 14 insertions, 28 deletions
diff --git a/src/filelock.c b/src/filelock.c
index 69e15a53846..769e5aa7a92 100644
--- a/src/filelock.c
+++ b/src/filelock.c
@@ -126,7 +126,7 @@ static void get_boot_time_1 (char *, int);
126#endif 126#endif
127 127
128static time_t 128static time_t
129get_boot_time () 129get_boot_time (void)
130{ 130{
131#if defined (BOOT_TIME) 131#if defined (BOOT_TIME)
132 int counter; 132 int counter;
@@ -253,9 +253,7 @@ get_boot_time ()
253 Success is indicated by setting BOOT_TIME to a larger value. */ 253 Success is indicated by setting BOOT_TIME to a larger value. */
254 254
255void 255void
256get_boot_time_1 (filename, newest) 256get_boot_time_1 (char *filename, int newest)
257 char *filename;
258 int newest;
259{ 257{
260 struct utmp ut, *utp; 258 struct utmp ut, *utp;
261 int desc; 259 int desc;
@@ -326,9 +324,7 @@ typedef struct
326 fill_in_lock_file_name (lock, (file))) 324 fill_in_lock_file_name (lock, (file)))
327 325
328static void 326static void
329fill_in_lock_file_name (lockfile, fn) 327fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn)
330 register char *lockfile;
331 register Lisp_Object fn;
332{ 328{
333 register char *p; 329 register char *p;
334 struct stat st; 330 struct stat st;
@@ -364,9 +360,7 @@ fill_in_lock_file_name (lockfile, fn)
364 Return 1 if successful, 0 if not. */ 360 Return 1 if successful, 0 if not. */
365 361
366static int 362static int
367lock_file_1 (lfname, force) 363lock_file_1 (char *lfname, int force)
368 char *lfname;
369 int force;
370{ 364{
371 register int err; 365 register int err;
372 time_t boot_time; 366 time_t boot_time;
@@ -408,8 +402,7 @@ lock_file_1 (lfname, force)
408/* Return 1 if times A and B are no more than one second apart. */ 402/* Return 1 if times A and B are no more than one second apart. */
409 403
410int 404int
411within_one_second (a, b) 405within_one_second (time_t a, time_t b)
412 time_t a, b;
413{ 406{
414 return (a - b >= -1 && a - b <= 1); 407 return (a - b >= -1 && a - b <= 1);
415} 408}
@@ -420,12 +413,10 @@ within_one_second (a, b)
420 or -1 if something is wrong with the locking mechanism. */ 413 or -1 if something is wrong with the locking mechanism. */
421 414
422static int 415static int
423current_lock_owner (owner, lfname) 416current_lock_owner (lock_info_type *owner, char *lfname)
424 lock_info_type *owner;
425 char *lfname;
426{ 417{
427#ifndef index 418#ifndef index
428 extern char *rindex (), *index (); 419 extern char *rindex (const char *, int), *index (const char *, int);
429#endif 420#endif
430 int len, ret; 421 int len, ret;
431 int local_owner = 0; 422 int local_owner = 0;
@@ -540,9 +531,7 @@ current_lock_owner (owner, lfname)
540 Return -1 if cannot lock for any other reason. */ 531 Return -1 if cannot lock for any other reason. */
541 532
542static int 533static int
543lock_if_free (clasher, lfname) 534lock_if_free (lock_info_type *clasher, register char *lfname)
544 lock_info_type *clasher;
545 register char *lfname;
546{ 535{
547 while (lock_file_1 (lfname, 0) == 0) 536 while (lock_file_1 (lfname, 0) == 0)
548 { 537 {
@@ -585,8 +574,7 @@ lock_if_free (clasher, lfname)
585 take away the lock, or return nil meaning ignore the lock. */ 574 take away the lock, or return nil meaning ignore the lock. */
586 575
587void 576void
588lock_file (fn) 577lock_file (Lisp_Object fn)
589 Lisp_Object fn;
590{ 578{
591 register Lisp_Object attack, orig_fn, encoded_fn; 579 register Lisp_Object attack, orig_fn, encoded_fn;
592 register char *lfname, *locker; 580 register char *lfname, *locker;
@@ -645,8 +633,7 @@ lock_file (fn)
645} 633}
646 634
647void 635void
648unlock_file (fn) 636unlock_file (register Lisp_Object fn)
649 register Lisp_Object fn;
650{ 637{
651 register char *lfname; 638 register char *lfname;
652 639
@@ -660,7 +647,7 @@ unlock_file (fn)
660} 647}
661 648
662void 649void
663unlock_all_files () 650unlock_all_files (void)
664{ 651{
665 register Lisp_Object tail; 652 register Lisp_Object tail;
666 register struct buffer *b; 653 register struct buffer *b;
@@ -709,8 +696,7 @@ should not be locked in that case. */)
709/* Unlock the file visited in buffer BUFFER. */ 696/* Unlock the file visited in buffer BUFFER. */
710 697
711void 698void
712unlock_buffer (buffer) 699unlock_buffer (struct buffer *buffer)
713 struct buffer *buffer;
714{ 700{
715 if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer) 701 if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer)
716 && STRINGP (buffer->file_truename)) 702 && STRINGP (buffer->file_truename))
@@ -750,14 +736,14 @@ t if it is locked by you, else a string saying which user has locked it. */)
750/* Initialization functions. */ 736/* Initialization functions. */
751 737
752void 738void
753init_filelock () 739init_filelock (void)
754{ 740{
755 boot_time = 0; 741 boot_time = 0;
756 boot_time_initialized = 0; 742 boot_time_initialized = 0;
757} 743}
758 744
759void 745void
760syms_of_filelock () 746syms_of_filelock (void)
761{ 747{
762 DEFVAR_LISP ("temporary-file-directory", &Vtemporary_file_directory, 748 DEFVAR_LISP ("temporary-file-directory", &Vtemporary_file_directory,
763 doc: /* The directory for writing temporary files. */); 749 doc: /* The directory for writing temporary files. */);