commit 967f581860117fd7a6835d7926d4a81b3cf1c1f5
parent 1075de1222e90c03020a0b2e19ca22737c201740
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 9 Jun 2019 20:02:58 +0200
tweaks: adjust some whitespace and rewrap a few lines
And remove two unneeded casts.
Diffstat:
6 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/chars.c b/src/chars.c
@@ -442,7 +442,7 @@ char *mbstrcasestr(const char *haystack, const char *needle)
return NULL;
} else
#endif
- return (char *) strcasestr(haystack, needle);
+ return (char *)strcasestr(haystack, needle);
}
/* This function is equivalent to strstr(), except in that it scans the
@@ -571,7 +571,7 @@ char *mbstrchr(const char *s, const char *c)
return (char *)q;
} else
#endif
- return (char *) strchr(s, *c);
+ return (char *)strchr(s, *c);
}
#endif /* !NANO_TINY || ENABLE_JUSTIFY */
diff --git a/src/color.c b/src/color.c
@@ -371,14 +371,14 @@ void precalc_multicolorinfo(void)
/* When the line contains a start match, look for an end, and if
* found, mark all the lines that are affected. */
while (regexec(ink->start, line->data + index, 1,
- &startmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
+ &startmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
/* Begin looking for an end match after the start match. */
index += startmatch.rm_eo;
/* If there is an end match on this line, mark the line, but
* continue looking for other starts after it. */
if (regexec(ink->end, line->data + index, 1,
- &endmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
+ &endmatch, (index == 0) ? 0 : REG_NOTBOL) == 0) {
line->multidata[ink->id] = CSTARTENDHERE;
index += endmatch.rm_eo;
/* If both start and end are mere anchors, step ahead. */
diff --git a/src/cut.c b/src/cut.c
@@ -35,10 +35,8 @@ void do_deletion(undo_type action)
/* When in the middle of a line, delete the current character. */
if (openfile->current->data[openfile->current_x] != '\0') {
- int charlen = char_length(openfile->current->data +
- openfile->current_x);
- size_t line_len = strlen(openfile->current->data +
- openfile->current_x);
+ int charlen = char_length(openfile->current->data + openfile->current_x);
+ size_t line_len = strlen(openfile->current->data + openfile->current_x);
#ifndef NANO_TINY
/* If the type of action changed or the cursor moved to a different
* line, create a new undo item, otherwise update the existing item. */
diff --git a/src/files.c b/src/files.c
@@ -266,7 +266,7 @@ int write_lockfile(const char *lockfilename, const char *origfilename, bool modi
goto free_the_data;
}
- openfile->lock_filename = (char *) lockfilename;
+ openfile->lock_filename = (char *)lockfilename;
free(lockdata);
return 1;
@@ -295,8 +295,8 @@ int delete_lockfile(const char *lockfilename)
* creating the lockfile but we should continue to load the file. */
int do_lockfile(const char *filename)
{
- char *namecopy = (char *) mallocstrcpy(NULL, filename);
- char *secondcopy = (char *) mallocstrcpy(NULL, filename);
+ char *namecopy = mallocstrcpy(NULL, filename);
+ char *secondcopy = mallocstrcpy(NULL, filename);
size_t locknamesize = strlen(filename) + strlen(locking_prefix)
+ strlen(locking_suffix) + 3;
char *lockfilename = charalloc(locknamesize);
diff --git a/src/text.c b/src/text.c
@@ -956,7 +956,7 @@ bool execute_command(const char *command)
/* Check which shell to use. If none is specified, use /bin/sh. */
shellenv = getenv("SHELL");
if (shellenv == NULL)
- shellenv = (char *) "/bin/sh";
+ shellenv = (char *)"/bin/sh";
/* Fork a child process to run the command in. */
if ((pid_of_command = fork()) == 0) {
diff --git a/src/winio.c b/src/winio.c
@@ -2494,8 +2494,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
/* If the match is of length zero, skip it. */
if (match.rm_so == match.rm_eo) {
- index = step_right(fileptr->data,
- index + match.rm_eo);
+ index = step_right(fileptr->data, index + match.rm_eo);
continue;
}
@@ -2517,8 +2516,7 @@ void edit_draw(linestruct *fileptr, const char *converted,
paintlen = actual_x(thetext, wideness(fileptr->data,
match.rm_eo) - from_col - start_col);
- mvwaddnstr(edit, row, margin + start_col,
- thetext, paintlen);
+ mvwaddnstr(edit, row, margin + start_col, thetext, paintlen);
}
goto tail_of_loop;
}