nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit b812ad2926f7c48b187e8a5eed7ba95ffdb9cd03
parent fe0b928b39af994f2dfec0269cafc9bb15911155
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Sat,  3 Aug 2024 10:21:44 +0200

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.)

Diffstat:
Msrc/browser.c | 3+--
Msrc/files.c | 4+---
Msrc/text.c | 3+--
3 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/src/browser.c b/src/browser.c @@ -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); } diff --git a/src/files.c b/src/files.c @@ -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 diff --git a/src/text.c b/src/text.c @@ -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;