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