tweaks: move a function to be before the ones that call it
parent
e877c2406e
commit
16c4f5bbd0
22
src/files.c
22
src/files.c
|
@ -148,6 +148,17 @@ void set_modified(void)
|
|||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Delete the lockfile. Return -1 if unsuccessful, and 1 otherwise. */
|
||||
int delete_lockfile(const char *lockfilename)
|
||||
{
|
||||
if (unlink(lockfilename) < 0 && errno != ENOENT) {
|
||||
statusline(MILD, _("Error deleting lock file %s: %s"),
|
||||
lockfilename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Write a lockfile, under the given lockfilename. This ALWAYS annihilates
|
||||
* an existing version of that file. Return 1 on success, and 0 on failure. */
|
||||
int write_lockfile(const char *lockfilename, const char *filename, bool modified)
|
||||
|
@ -256,17 +267,6 @@ int write_lockfile(const char *lockfilename, const char *filename, bool modified
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Delete the lockfile. Return -1 if unsuccessful, and 1 otherwise. */
|
||||
int delete_lockfile(const char *lockfilename)
|
||||
{
|
||||
if (unlink(lockfilename) < 0 && errno != ENOENT) {
|
||||
statusline(MILD, _("Error deleting lock file %s: %s"),
|
||||
lockfilename, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Deal with lockfiles. Return -1 on refusing to override the lockfile,
|
||||
* and 1 on successfully creating it; 0 means we were not successful in
|
||||
* creating the lockfile but we should continue to load the file. */
|
||||
|
|
|
@ -279,6 +279,9 @@ void paste_text(void);
|
|||
|
||||
/* Most functions in files.c. */
|
||||
void make_new_buffer(void);
|
||||
#ifndef NANO_TINY
|
||||
int delete_lockfile(const char *lockfilename);
|
||||
#endif
|
||||
void set_modified(void);
|
||||
bool open_buffer(const char *filename, bool new_buffer);
|
||||
#ifdef ENABLE_SPELLER
|
||||
|
@ -304,7 +307,6 @@ bool outside_of_confinement(const char *currpath, bool allow_tabcomp);
|
|||
#endif
|
||||
#ifndef NANO_TINY
|
||||
void init_backup_dir(void);
|
||||
int delete_lockfile(const char *lockfilename);
|
||||
int write_lockfile(const char *lockfilename, const char *filename, bool modified);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out, bool close_out);
|
||||
|
|
Loading…
Reference in New Issue