tweaks: change a function with two possible results to boolean
parent
cc2b4f712c
commit
d5ce44820a
10
src/files.c
10
src/files.c
|
@ -133,14 +133,14 @@ void make_new_buffer(void)
|
||||||
|
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
/* Delete the lockfile. Return -1 if unsuccessful, and 1 otherwise. */
|
/* Delete the lockfile. Return -1 if unsuccessful, and 1 otherwise. */
|
||||||
int delete_lockfile(const char *lockfilename)
|
bool delete_lockfile(const char *lockfilename)
|
||||||
{
|
{
|
||||||
if (unlink(lockfilename) < 0 && errno != ENOENT) {
|
if (unlink(lockfilename) < 0 && errno != ENOENT) {
|
||||||
statusline(MILD, _("Error deleting lock file %s: %s"),
|
statusline(MILD, _("Error deleting lock file %s: %s"),
|
||||||
lockfilename, strerror(errno));
|
lockfilename, strerror(errno));
|
||||||
return -1;
|
return FALSE;
|
||||||
}
|
} else
|
||||||
return 1;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Write a lockfile, under the given lockfilename. This ALWAYS annihilates
|
/* Write a lockfile, under the given lockfilename. This ALWAYS annihilates
|
||||||
|
@ -179,7 +179,7 @@ int write_lockfile(const char *lockfilename, const char *filename, bool modified
|
||||||
|
|
||||||
/* If the lockfile exists, try to delete it. */
|
/* If the lockfile exists, try to delete it. */
|
||||||
if (stat(lockfilename, &fileinfo) != -1)
|
if (stat(lockfilename, &fileinfo) != -1)
|
||||||
if (delete_lockfile(lockfilename) < 0)
|
if (!delete_lockfile(lockfilename))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (ISSET(INSECURE_BACKUP))
|
if (ISSET(INSECURE_BACKUP))
|
||||||
|
|
|
@ -279,7 +279,7 @@ void paste_text(void);
|
||||||
/* Most functions in files.c. */
|
/* Most functions in files.c. */
|
||||||
void make_new_buffer(void);
|
void make_new_buffer(void);
|
||||||
#ifndef NANO_TINY
|
#ifndef NANO_TINY
|
||||||
int delete_lockfile(const char *lockfilename);
|
bool delete_lockfile(const char *lockfilename);
|
||||||
#endif
|
#endif
|
||||||
bool open_buffer(const char *filename, bool new_buffer);
|
bool open_buffer(const char *filename, bool new_buffer);
|
||||||
#ifdef ENABLE_SPELLER
|
#ifdef ENABLE_SPELLER
|
||||||
|
|
Loading…
Reference in New Issue