Mercurial > hg > xemacs-beta
comparison src/filelock.c @ 80:1ce6082ce73f r20-0b90
Import from CVS: tag r20-0b90
author | cvs |
---|---|
date | Mon, 13 Aug 2007 09:06:37 +0200 |
parents | 131b0175ea99 |
children | 4be1180a9e89 |
comparison
equal
deleted
inserted
replaced
79:5b0a5bbffab6 | 80:1ce6082ce73f |
---|---|
67 MAKE_LOCK_NAME assumes you have already verified that Vlock_directory | 67 MAKE_LOCK_NAME assumes you have already verified that Vlock_directory |
68 is a string. */ | 68 is a string. */ |
69 | 69 |
70 #ifndef HAVE_LONG_FILE_NAMES | 70 #ifndef HAVE_LONG_FILE_NAMES |
71 | 71 |
72 #define MAKE_LOCK_NAME(lock, file) \ | 72 #define MAKE_LOCK_NAME(lock, file) \ |
73 (lock = (char *) alloca (14 + XSTRING_LENGTH (Vlock_directory) + \ | 73 (lock = (char *) alloca (14 + XSTRING_LENGTH (Vlock_directory) + 1), \ |
74 1), \ | |
75 fill_in_lock_short_file_name (lock, (file))) | 74 fill_in_lock_short_file_name (lock, (file))) |
76 | 75 |
77 static void | 76 static void |
78 fill_in_lock_short_file_name (REGISTER char *lockfile, REGISTER Lisp_Object fn) | 77 fill_in_lock_short_file_name (REGISTER char *lockfile, REGISTER Lisp_Object fn) |
79 { | 78 { |
105 | 104 |
106 { | 105 { |
107 int need_slash = 0; | 106 int need_slash = 0; |
108 | 107 |
109 /* in case lock-directory doesn't end in / */ | 108 /* in case lock-directory doesn't end in / */ |
110 if (string_byte (XSTRING (Vlock_directory), | 109 if (XSTRING_BYTE (Vlock_directory, |
111 XSTRING_LENGTH (Vlock_directory) - 1) != '/') | 110 XSTRING_LENGTH (Vlock_directory) - 1) != '/') |
112 need_slash = 1; | 111 need_slash = 1; |
113 | 112 |
114 sprintf (lockfile, "%s%s%.2x%.2x%.2x%.2x%.2x%.2x%.2x", | 113 sprintf (lockfile, "%s%s%.2x%.2x%.2x%.2x%.2x%.2x%.2x", |
115 (char *) XSTRING_DATA (Vlock_directory), | 114 (char *) XSTRING_DATA (Vlock_directory), |
120 } | 119 } |
121 | 120 |
122 #else /* defined HAVE_LONG_FILE_NAMES */ | 121 #else /* defined HAVE_LONG_FILE_NAMES */ |
123 | 122 |
124 /* +2 for terminating null and possible extra slash */ | 123 /* +2 for terminating null and possible extra slash */ |
125 #define MAKE_LOCK_NAME(lock, file) \ | 124 #define MAKE_LOCK_NAME(lock, file) \ |
126 (lock = (char *) alloca (XSTRING_LENGTH (file) + \ | 125 (lock = (char *) alloca (XSTRING_LENGTH (file) + \ |
127 XSTRING_LENGTH (Vlock_directory) + 2),\ | 126 XSTRING_LENGTH (Vlock_directory) + 2), \ |
128 fill_in_lock_file_name (lock, (file))) | 127 fill_in_lock_file_name (lock, (file))) |
129 | 128 |
130 static void | 129 static void |
131 fill_in_lock_file_name (REGISTER char *lockfile, REGISTER Lisp_Object fn) | 130 fill_in_lock_file_name (REGISTER char *lockfile, REGISTER Lisp_Object fn) |
132 /* fn must be a Lisp_String! */ | 131 /* fn must be a Lisp_String! */ |