]> git.wh0rd.org Git - nano.git/commitdiff
Renaming a variable for conciseness.
authorBenno Schulenberg <bensberg@justemail.net>
Fri, 26 Feb 2016 17:11:35 +0000 (17:11 +0000)
committerBenno Schulenberg <bensberg@justemail.net>
Fri, 26 Feb 2016 17:11:35 +0000 (17:11 +0000)
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@5687 35c25a1d-7b9e-4130-9fde-d3aeb78583b8

ChangeLog
src/color.c

index 9707a43ac328ae318054301af725b420f2f15d26..73280676aa02ef8665d99234399af9bce341ff18 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
 
index bd6700311c012698eb64f410761aea199be53f06..0905617d3d8eba6664abe86da1218f4fe46488a7 100644 (file)
@@ -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;
            }
        }