tweaks: remove the two remaining handfuls of asserts

They are just clutter -- no one runs a debug build for any length
of time.
master
Benno Schulenberg 2019-05-19 18:58:02 +02:00
parent 53352d0b26
commit 4f1eb5fdd4
3 changed files with 1 additions and 24 deletions

View File

@ -77,8 +77,6 @@ char *do_browser(char *path)
present_name = mallocstrcpy(present_name, filelist[selected]);
}
assert(path != NULL && path[strlen(path) - 1] == '/');
if (dir != NULL) {
/* Get the file list, and set longest and width in the process. */
read_the_list(path, dir);
@ -392,8 +390,6 @@ void read_the_list(const char *path, DIR *dir)
const struct dirent *nextdir;
size_t i = 0, path_len = strlen(path);
assert(path != NULL && path[strlen(path) - 1] == '/' && dir != NULL);
longest = 0;
/* Find the length of the longest filename in the current folder. */
@ -443,8 +439,6 @@ void read_the_list(const char *path, DIR *dir)
* filelist, so record it. */
filelist_len = i;
assert(filelist != NULL);
/* Sort the list of names. */
qsort(filelist, filelist_len, sizeof(char *), diralphasort);

View File

@ -1295,8 +1295,6 @@ char *get_full_path(const char *origpath)
/* If we didn't find one, then make sure the answer is in the format
* "d_here/d_there". */
if (last_slash == NULL) {
assert(!path_only);
d_there_file = d_there;
d_there = d_here;
} else {
@ -1515,8 +1513,6 @@ int copy_file(FILE *inn, FILE *out, bool close_out)
size_t charsread;
int (*flush_out_fnc)(FILE *) = (close_out) ? fclose : fflush;
assert(inn != NULL && out != NULL && inn != out);
do {
charsread = fread(buf, sizeof(char), BUFSIZ, inn);
if (charsread == 0 && ferror(inn)) {
@ -2420,8 +2416,6 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
const struct passwd *userdata;
#endif
assert(buf != NULL && num_matches != NULL && buf_len > 0);
*num_matches = 0;
#ifdef HAVE_PWD_H
@ -2486,8 +2480,6 @@ char **cwd_tab_completion(const char *buf, bool allow_files,
dirname = mallocstrcpy(NULL, present_path);
}
assert(dirname[strlen(dirname) - 1] == '/');
dir = opendir(dirname);
if (dir == NULL) {
@ -2551,9 +2543,6 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
size_t num_matches = 0, buf_len;
char **matches = NULL;
assert(buf != NULL && place != NULL && *place <= strlen(buf) &&
lastwastab != NULL && refresh_func != NULL && listed != NULL);
*listed = FALSE;
/* If the word starts with `~' and there is no slash in the word,
@ -2610,14 +2599,9 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
glued = charalloc(strlen(present_path) + strlen(mzero) + 1);
sprintf(glued, "%s%s", present_path, mzero);
assert(common_len >= *place);
if (num_matches == 1 && (is_dir(mzero) || is_dir(glued))) {
if (num_matches == 1 && (is_dir(mzero) || is_dir(glued)))
mzero[common_len++] = '/';
assert(common_len > *place);
}
if (num_matches > 1 && (common_len != *place || !*lastwastab))
beep();

View File

@ -120,7 +120,6 @@
#include <dirent.h>
#include <regex.h>
#include <signal.h>
#include <assert.h>
/* If we aren't using an ncurses with mouse support, exclude any
* mouse routines, as they are useless then. */