Adjusting some comments, and removing an unneeded 'if'.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4752 35c25a1d-7b9e-4130-9fde-d3aeb78583b8master
parent
de597bce92
commit
598c654294
|
@ -1,5 +1,7 @@
|
|||
2014-04-08 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/rcfile.c: Correct two comments, and tweak two others.
|
||||
* src/color.c (color_update): Correct one comment, tweak some others,
|
||||
remove two superfluous ones, and remove an unneeded 'if'.
|
||||
|
||||
2014-04-08 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* src/nano.c (main): Convert the literal UTF-8 whitespace string into
|
||||
|
|
24
src/color.c
24
src/color.c
|
@ -181,7 +181,7 @@ void color_update(void)
|
|||
|
||||
/* If we didn't specify a syntax override string, or if we did and
|
||||
* there was no syntax by that name, get the syntax based on the
|
||||
* file extension, and then look in the header. */
|
||||
* file extension, then try magic, and then look in the header. */
|
||||
if (openfile->colorstrings == NULL) {
|
||||
for (tmpsyntax = syntaxes; tmpsyntax != NULL;
|
||||
tmpsyntax = tmpsyntax->next) {
|
||||
|
@ -206,7 +206,7 @@ void color_update(void)
|
|||
regcomp(e->ext, fixbounds(e->ext_regex), REG_EXTENDED);
|
||||
}
|
||||
|
||||
/* Set colorstrings if we matched the extension regex. */
|
||||
/* Set colorstrings if we match the extension regex. */
|
||||
if (regexec(e->ext, openfile->filename, 0, NULL, 0) == 0) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
|
@ -235,9 +235,9 @@ void color_update(void)
|
|||
regcomp(e->ext, fixbounds(e->ext_regex), REG_EXTENDED);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr,"Matching regex \"%s\" against \"%s\"\n",e->ext_regex, magicstring);
|
||||
fprintf(stderr, "Matching regex \"%s\" against \"%s\"\n", e->ext_regex, magicstring);
|
||||
#endif
|
||||
|
||||
/* Set colorstrings if we match the magic-string regex. */
|
||||
if (magicstring && regexec(e->ext, magicstring, 0, NULL, 0) == 0) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
|
@ -262,28 +262,21 @@ void color_update(void)
|
|||
for (e = tmpsyntax->headers; e != NULL; e = e->next) {
|
||||
bool not_compiled = (e->ext == NULL);
|
||||
|
||||
/* e->ext_regex has already been checked for validity
|
||||
* elsewhere. Compile its specified regex if we haven't
|
||||
* already. */
|
||||
if (not_compiled) {
|
||||
e->ext = (regex_t *)nmalloc(sizeof(regex_t));
|
||||
regcomp(e->ext, fixbounds(e->ext_regex), REG_EXTENDED);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Comparing header regex \"%s\" to fileage \"%s\"...\n", e->ext_regex, openfile->fileage->data);
|
||||
fprintf(stderr, "Comparing header regex \"%s\" to fileage \"%s\"...\n",
|
||||
e->ext_regex, openfile->fileage->data);
|
||||
#endif
|
||||
/* Set colorstrings if we matched the extension regex. */
|
||||
/* Set colorstrings if we match the header-line regex. */
|
||||
if (regexec(e->ext, openfile->fileage->data, 0, NULL, 0) == 0) {
|
||||
openfile->syntax = tmpsyntax;
|
||||
openfile->colorstrings = tmpsyntax->color;
|
||||
break;
|
||||
}
|
||||
|
||||
if (openfile->colorstrings != NULL)
|
||||
break;
|
||||
|
||||
/* Decompile e->ext_regex's specified regex if we aren't
|
||||
* going to use it. */
|
||||
if (not_compiled)
|
||||
nfreeregex(&e->ext);
|
||||
}
|
||||
|
@ -291,7 +284,6 @@ void color_update(void)
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
/* If we didn't find any syntax yet, and we do have a default one,
|
||||
* use it. */
|
||||
if (openfile->colorstrings == NULL && defcolor != NULL) {
|
||||
|
|
Loading…
Reference in New Issue