diff options
author | Ben Longbons <b.r.longbons@gmail.com> | 2012-08-30 16:16:25 -0700 |
---|---|---|
committer | Ben Longbons <b.r.longbons@gmail.com> | 2012-08-30 17:03:31 -0700 |
commit | 41974ae5265fbc23a06f276f9e008d5dad020e0b (patch) | |
tree | 9d595215172e87e2d83b74f7bf3430b3040e780e /src/common/lock.c | |
parent | 21742909143df9159b2401c3e2a39cc0b2bad620 (diff) | |
download | tmwa-41974ae5265fbc23a06f276f9e008d5dad020e0b.tar.gz tmwa-41974ae5265fbc23a06f276f9e008d5dad020e0b.tar.bz2 tmwa-41974ae5265fbc23a06f276f9e008d5dad020e0b.tar.xz tmwa-41974ae5265fbc23a06f276f9e008d5dad020e0b.zip |
Rename files for C++ conversion. Does not compile.
After updating, you can remove these files, as shown in 'git status':
Untracked files:
(use "git add <file>..." to include in what will be committed)
src/map/magic-interpreter-lexer.c
src/map/magic-interpreter-parser.c
src/map/magic-interpreter-parser.h
Diffstat (limited to 'src/common/lock.c')
-rw-r--r-- | src/common/lock.c | 36 |
1 files changed, 0 insertions, 36 deletions
diff --git a/src/common/lock.c b/src/common/lock.c deleted file mode 100644 index dd42ef2..0000000 --- a/src/common/lock.c +++ /dev/null @@ -1,36 +0,0 @@ -#include <unistd.h> -#include <stdio.h> -#include "lock.h" -#include "socket.h" - -/// Protected file writing -/// (Until the file is closed, it keeps the old file) - -// Start writing a tmpfile -FILE *lock_fopen (const char *filename, int *info) -{ - char newfile[512]; - FILE *fp; - int no = getpid (); - - // Get a filename that doesn't already exist - do - { - sprintf (newfile, "%s_%d.tmp", filename, no++); - } - while ((fp = fopen_ (newfile, "r")) && (fclose_ (fp), 1)); - *info = --no; - return fopen_ (newfile, "w"); -} - -// Delete the old file and rename the new file -void lock_fclose (FILE * fp, const char *filename, int *info) -{ - char newfile[512]; - if (fp) - { - fclose_ (fp); - sprintf (newfile, "%s_%d.tmp", filename, *info); - rename (newfile, filename); - } -} |