mirror of
git://git.sv.gnu.org/nano.git
synced 2024-11-22 04:41:21 +03:00
Renaming a variable for conciseness.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5687 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
parent
4d53694a27
commit
e74a4c26c0
@ -6,6 +6,7 @@
|
||||
all else failed -- forego the small, complicating optimization.
|
||||
* src/color.c (color_update): Strip things bare to see the sameness.
|
||||
* src/color.c (found_in_list): Factor out this triple repetition.
|
||||
* src/color.c (color_update): Rename a variable for conciseness.
|
||||
|
||||
GNU nano 2.5.3 - 2016.02.25
|
||||
|
||||
|
49
src/color.c
49
src/color.c
@ -177,7 +177,7 @@ bool found_in_list(regexlisttype *head, const char *shibboleth)
|
||||
/* Update the color information based on the current filename. */
|
||||
void color_update(void)
|
||||
{
|
||||
syntaxtype *tmpsyntax;
|
||||
syntaxtype *sint;
|
||||
colortype *tmpcolor;
|
||||
|
||||
assert(openfile != NULL);
|
||||
@ -196,11 +196,10 @@ void color_update(void)
|
||||
if (strcmp(syntaxstr, "none") == 0)
|
||||
return;
|
||||
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcmp(tmpsyntax->desc, syntaxstr) == 0) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
for (sint = syntaxes; sint != NULL; sint = sint->next) {
|
||||
if (strcmp(sint->desc, syntaxstr) == 0) {
|
||||
openfile->syntax = sint;
|
||||
openfile->colorstrings = sint->color;
|
||||
}
|
||||
|
||||
if (openfile->colorstrings != NULL)
|
||||
@ -230,12 +229,10 @@ void color_update(void)
|
||||
if (fullname == NULL)
|
||||
fullname = mallocstrcpy(fullname, openfile->filename);
|
||||
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
|
||||
if (found_in_list(tmpsyntax->extensions, fullname)) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
for (sint = syntaxes; sint != NULL; sint = sint->next) {
|
||||
if (found_in_list(sint->extensions, fullname)) {
|
||||
openfile->syntax = sint;
|
||||
openfile->colorstrings = sint->color;
|
||||
}
|
||||
}
|
||||
|
||||
@ -247,12 +244,10 @@ void color_update(void)
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "No result from file extension, trying headerline...\n");
|
||||
#endif
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
|
||||
if (found_in_list(tmpsyntax->headers, openfile->fileage->data)) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
for (sint = syntaxes; sint != NULL; sint = sint->next) {
|
||||
if (found_in_list(sint->headers, openfile->fileage->data)) {
|
||||
openfile->syntax = sint;
|
||||
openfile->colorstrings = sint->color;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -289,11 +284,10 @@ void color_update(void)
|
||||
|
||||
/* Now try and find a syntax that matches the magicstring. */
|
||||
if (magicstring != NULL) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (found_in_list(tmpsyntax->magics, magicstring)) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
for (sint = syntaxes; sint != NULL; sint = sint->next) {
|
||||
if (found_in_list(sint->magics, magicstring)) {
|
||||
openfile->syntax = sint;
|
||||
openfile->colorstrings = sint->color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -307,11 +301,10 @@ void color_update(void)
|
||||
|
||||
/* If we didn't find any syntax yet, see if there is a default one. */
|
||||
if (openfile->colorstrings == NULL) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
if (strcmp(tmpsyntax->desc, "default") == 0) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
for (sint = syntaxes; sint != NULL; sint = sint->next) {
|
||||
if (strcmp(sint->desc, "default") == 0) {
|
||||
openfile->syntax = sint;
|
||||
openfile->colorstrings = sint->color;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user