tweaks: adjust some whitespace and rewrap a few lines

And remove two unneeded casts.
This commit is contained in:
Benno Schulenberg 2019-06-09 20:02:58 +02:00
parent 1075de1222
commit 967f581860
6 changed files with 12 additions and 16 deletions

View File

@ -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 */

View File

@ -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. */

View File

@ -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. */

View File

@ -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);

View File

@ -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) {

View File

@ -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;
}