tweaks: unwrap three lines that don't need to be wrapped

(These lines were noticed while checking that all
calls of nrealloc() use a size bigger than zero.)
This commit is contained in:
Benno Schulenberg 2024-08-03 10:21:44 +02:00
parent fe0b928b39
commit b812ad2926
3 changed files with 3 additions and 7 deletions

View File

@ -572,8 +572,7 @@ char *browse(char *path)
/* If the given path is relative, join it with the current path. */
if (*path != '/') {
path = nrealloc(path, strlen(present_path) +
strlen(answer) + 1);
path = nrealloc(path, strlen(present_path) + strlen(answer) + 1);
sprintf(path, "%s%s", present_path, answer);
}

View File

@ -2547,9 +2547,7 @@ char **filename_completion(const char *morsel, size_t *num_matches)
if (strncmp(entry->d_name, filename, filenamelen) == 0 &&
strcmp(entry->d_name, ".") != 0 &&
strcmp(entry->d_name, "..") != 0) {
fullname = nrealloc(fullname, strlen(dirname) +
strlen(entry->d_name) + 1);
fullname = nrealloc(fullname, strlen(dirname) + strlen(entry->d_name) + 1);
sprintf(fullname, "%s%s", dirname, entry->d_name);
#ifdef ENABLE_OPERATINGDIR

View File

@ -1588,8 +1588,7 @@ void concat_paragraph(linestruct *line, size_t count)
line->data[line_len] = '\0';
}
line->data = nrealloc(line->data,
line_len + next_line_len - next_lead_len + 1);
line->data = nrealloc(line->data, line_len + next_line_len - next_lead_len + 1);
strcat(line->data, next_line->data + next_lead_len);
#ifndef NANO_TINY
line->has_anchor |= next_line->has_anchor;