]> git.refcnt.org Git - colorize.git/blobdiff - colorize.c
Const pointer
[colorize.git] / colorize.c
index 16094c6e673c3e51eb33629a226700df0dfc62ed..5f64ce762430c78add614cc1101aea4a1f7674dc 100644 (file)
@@ -183,7 +183,7 @@ static const char *formats[] = {
     "%s: %s: %s",             /* type    */
 };
 
-enum { FOREGROUND, BACKGROUND };
+enum { GENERIC, FOREGROUND = 0, BACKGROUND };
 
 static const struct {
     struct color const *entries;
@@ -372,9 +372,9 @@ process_opts (int argc, char **argv)
                     unsigned int i;
                     exclude = xstrdup (optarg);
                     STACK_VAR (exclude);
-                    for (i = 1; i < tables[FOREGROUND].count - 1; i++) /* skip color none and default */
+                    for (i = 1; i < tables[GENERIC].count - 1; i++) /* skip color none and default */
                       {
-                        const struct color *entry = &tables[FOREGROUND].entries[i];
+                        const struct color *entry = &tables[GENERIC].entries[i];
                         if (streq (exclude, entry->name))
                           {
                             valid = true;
@@ -635,9 +635,9 @@ skip_path_colors (const char *color_string, const char *file_string, const struc
       {
         bool matched = false;
         unsigned int i;
-        for (i = 0; i < tables[FOREGROUND].count; i++)
+        for (i = 0; i < tables[GENERIC].count; i++)
           {
-            const struct color *entry = &tables[FOREGROUND].entries[i];
+            const struct color *entry = &tables[GENERIC].entries[i];
             if (has_color_name (color, entry->name))
               {
                 color += strlen (entry->name);
@@ -1075,7 +1075,7 @@ gather_esc_offsets (const char *p, const char **start, const char **end)
     if (*p == 27 && *(p + 1) == '[')
       {
         bool valid = false;
-        const char *begin = p;
+        const char *const begin = p;
         p += 2;
         if (clean_all)
           valid = validate_esc_clean_all (&p);