tweaks: drop a bunch of useless asserts
parent
8b1f283a73
commit
1146381765
20
src/files.c
20
src/files.c
|
@ -430,8 +430,6 @@ bool open_buffer(const char *filename, bool undoable)
|
||||||
/* rc == -2 means that we have a new file. -1 means that the
|
/* rc == -2 means that we have a new file. -1 means that the
|
||||||
* open() failed. 0 means that the open() succeeded. */
|
* open() failed. 0 means that the open() succeeded. */
|
||||||
|
|
||||||
assert(filename != NULL);
|
|
||||||
|
|
||||||
/* Display newlines in filenames as ^J. */
|
/* Display newlines in filenames as ^J. */
|
||||||
as_an_at = FALSE;
|
as_an_at = FALSE;
|
||||||
|
|
||||||
|
@ -527,8 +525,6 @@ void replace_buffer(const char *filename)
|
||||||
FILE *f;
|
FILE *f;
|
||||||
int descriptor;
|
int descriptor;
|
||||||
|
|
||||||
assert(filename != NULL && filename[0] != '\0');
|
|
||||||
|
|
||||||
/* Open the file quietly. */
|
/* Open the file quietly. */
|
||||||
descriptor = open_file(filename, FALSE, TRUE, &f);
|
descriptor = open_file(filename, FALSE, TRUE, &f);
|
||||||
|
|
||||||
|
@ -605,8 +601,6 @@ void prepare_for_display(void)
|
||||||
* otherwise, to the previous one. */
|
* otherwise, to the previous one. */
|
||||||
void switch_to_prevnext_buffer(bool to_next)
|
void switch_to_prevnext_buffer(bool to_next)
|
||||||
{
|
{
|
||||||
assert(openfile != NULL);
|
|
||||||
|
|
||||||
/* If only one file buffer is open, say so and get out. */
|
/* If only one file buffer is open, say so and get out. */
|
||||||
if (openfile == openfile->next && !inhelp) {
|
if (openfile == openfile->next && !inhelp) {
|
||||||
statusbar(_("No more open file buffers"));
|
statusbar(_("No more open file buffers"));
|
||||||
|
@ -664,8 +658,6 @@ void switch_to_next_buffer_void(void)
|
||||||
* open buffers. */
|
* open buffers. */
|
||||||
bool close_buffer(void)
|
bool close_buffer(void)
|
||||||
{
|
{
|
||||||
assert(openfile != NULL);
|
|
||||||
|
|
||||||
/* If only one file buffer is open, get out. */
|
/* If only one file buffer is open, get out. */
|
||||||
if (openfile == openfile->next)
|
if (openfile == openfile->next)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -705,8 +697,6 @@ int is_file_writable(const char *filename)
|
||||||
if (ISSET(VIEW_MODE))
|
if (ISSET(VIEW_MODE))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
assert(filename != NULL);
|
|
||||||
|
|
||||||
/* Get the specified file's full path. */
|
/* Get the specified file's full path. */
|
||||||
full_filename = get_full_path(filename);
|
full_filename = get_full_path(filename);
|
||||||
|
|
||||||
|
@ -958,8 +948,6 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
|
||||||
int fd;
|
int fd;
|
||||||
char *full_filename;
|
char *full_filename;
|
||||||
|
|
||||||
assert(filename != NULL && f != NULL);
|
|
||||||
|
|
||||||
/* Get the specified file's full path. */
|
/* Get the specified file's full path. */
|
||||||
full_filename = get_full_path(filename);
|
full_filename = get_full_path(filename);
|
||||||
|
|
||||||
|
@ -1023,8 +1011,6 @@ char *get_next_filename(const char *name, const char *suffix)
|
||||||
char *buf;
|
char *buf;
|
||||||
size_t wholenamelen;
|
size_t wholenamelen;
|
||||||
|
|
||||||
assert(name != NULL && suffix != NULL);
|
|
||||||
|
|
||||||
wholenamelen = strlen(name) + strlen(suffix);
|
wholenamelen = strlen(name) + strlen(suffix);
|
||||||
|
|
||||||
/* Reserve space for: the name plus the suffix plus a dot plus
|
/* Reserve space for: the name plus the suffix plus a dot plus
|
||||||
|
@ -1391,8 +1377,6 @@ char *safe_tempfile(FILE **f)
|
||||||
int fd;
|
int fd;
|
||||||
mode_t original_umask = 0;
|
mode_t original_umask = 0;
|
||||||
|
|
||||||
assert(f != NULL);
|
|
||||||
|
|
||||||
/* If $TMPDIR is set, set tempdir to it, run it through
|
/* If $TMPDIR is set, set tempdir to it, run it through
|
||||||
* get_full_path(), and save the result in full_tempdir. Otherwise,
|
* get_full_path(), and save the result in full_tempdir. Otherwise,
|
||||||
* leave full_tempdir set to NULL. */
|
* leave full_tempdir set to NULL. */
|
||||||
|
@ -1433,8 +1417,6 @@ char *safe_tempfile(FILE **f)
|
||||||
/* Initialize full_operating_dir based on operating_dir. */
|
/* Initialize full_operating_dir based on operating_dir. */
|
||||||
void init_operating_dir(void)
|
void init_operating_dir(void)
|
||||||
{
|
{
|
||||||
assert(full_operating_dir == NULL);
|
|
||||||
|
|
||||||
if (operating_dir == NULL)
|
if (operating_dir == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -1466,8 +1448,6 @@ bool check_operating_dir(const char *currpath, bool allow_tabcomp)
|
||||||
if (operating_dir == NULL)
|
if (operating_dir == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
assert(full_operating_dir != NULL);
|
|
||||||
|
|
||||||
fullpath = get_full_path(currpath);
|
fullpath = get_full_path(currpath);
|
||||||
|
|
||||||
/* If fullpath is NULL, it means some directory in the path doesn't
|
/* If fullpath is NULL, it means some directory in the path doesn't
|
||||||
|
|
Loading…
Reference in New Issue