diff src/filelock.c @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents 7e54bd776075
children 1ce6082ce73f
line wrap: on
line diff
--- a/src/filelock.c	Mon Aug 13 09:00:04 2007 +0200
+++ b/src/filelock.c	Mon Aug 13 09:02:59 2007 +0200
@@ -69,8 +69,9 @@
 
 #ifndef HAVE_LONG_FILE_NAMES
 
-#define MAKE_LOCK_NAME(lock, file)					\
-  (lock = (char *) alloca (14 + XSTRING_LENGTH (Vlock_directory) + 1),	\
+#define MAKE_LOCK_NAME(lock, file)					    \
+  (lock = (char *) alloca (14 + XSTRING_LENGTH (Vlock_directory) + \
+			   1),						    \
    fill_in_lock_short_file_name (lock, (file)))
 
 static void
@@ -106,7 +107,7 @@
     int need_slash = 0;
 
     /* in case lock-directory doesn't end in / */
-    if (XSTRING_BYTE (Vlock_directory,
+    if (string_byte (XSTRING (Vlock_directory),
 		     XSTRING_LENGTH (Vlock_directory) - 1) != '/')
       need_slash = 1;
 
@@ -121,9 +122,9 @@
 #else /* defined HAVE_LONG_FILE_NAMES */
 
 /* +2 for terminating null and possible extra slash */
-#define MAKE_LOCK_NAME(lock, file)					\
-  (lock = (char *) alloca (XSTRING_LENGTH (file) +			\
-			   XSTRING_LENGTH (Vlock_directory) + 2),	\
+#define MAKE_LOCK_NAME(lock, file)				\
+  (lock = (char *) alloca (XSTRING_LENGTH (file) +		\
+			   XSTRING_LENGTH (Vlock_directory) + 2),\
    fill_in_lock_file_name (lock, (file)))
 
 static void
@@ -196,11 +197,7 @@
 void
 lock_file (Lisp_Object fn)
 {
-  /* This function can GC. */
-  /* dmoore - and can destroy current_buffer and all sorts of other
-     mean nasty things with pointy teeth.  If you call this make sure
-     you protect things right. */
-
+  /* This function can GC */
   REGISTER Lisp_Object attack, orig_fn;
   REGISTER char *lfname;
   struct gcpro gcpro1, gcpro2;
@@ -339,11 +336,6 @@
 void
 unlock_file (Lisp_Object fn)
 {
-  /* This function can GC. */
-  /* dmoore - and can destroy current_buffer and all sorts of other
-     mean nasty things with pointy teeth.  If you call this make sure
-     you protect things right. */
-
   REGISTER char *lfname;
   if (NILP (Vlock_directory) || NILP (Vsuperlock_file)) return;
   CHECK_STRING (fn);
@@ -400,13 +392,9 @@
 void
 unlock_all_files (void)
 {
-  /* This function can GC. */
-
-  Lisp_Object tail;
+  REGISTER Lisp_Object tail;
   REGISTER struct buffer *b;
-  struct gcpro gcpro1;
 
-  GCPRO1 (tail);
   for (tail = Vbuffer_alist; GC_CONSP (tail);
        tail = XCDR (tail))
     {
@@ -415,7 +403,6 @@
 	  BUF_SAVE_MODIFF (b) < BUF_MODIFF (b))
 	unlock_file (b->file_truename);
     }
-  UNGCPRO;
 }
 
 
@@ -427,10 +414,6 @@
        (fn))
 {
   /* This function can GC */
-  /* dmoore - and can destroy current_buffer and all sorts of other
-     mean nasty things with pointy teeth.  If you call this make sure
-     you protect things right. */
-
   if (NILP (fn))
     fn = current_buffer->file_truename;
   CHECK_STRING (fn);
@@ -446,11 +429,6 @@
 */
        ())
 {
-  /* This function can GC */
-  /* dmoore - and can destroy current_buffer and all sorts of other
-     mean nasty things with pointy teeth.  If you call this make sure
-     you protect things right. */
-
   if (BUF_SAVE_MODIFF (current_buffer) < BUF_MODIFF (current_buffer)
       && STRINGP (current_buffer->file_truename))
     unlock_file (current_buffer->file_truename);
@@ -463,10 +441,6 @@
 void
 unlock_buffer (struct buffer *buffer)
 {
-  /* This function can GC */
-  /* dmoore - and can destroy current_buffer and all sorts of other
-     mean nasty things with pointy teeth.  If you call this make sure
-     you protect things right. */
   if (BUF_SAVE_MODIFF (buffer) < BUF_MODIFF (buffer)
       && STRINGP (buffer->file_truename))
     unlock_file (buffer->file_truename);