]> git.refcnt.org Git - colorize.git/blobdiff - colorize.c
main(): amend wording of diagnostic
[colorize.git] / colorize.c
index 2a8d843c539382ee2c18c7179d56beeb1a50a47f..608eb2fe06c89f96f4505b469e4d803237ae64b7 100644 (file)
@@ -383,8 +383,12 @@ main (int argc, char **argv)
 
 #if DEBUG
     log = open_file (DEBUG_FILE, "w");
-    STACK_FILE (log);
     print_tstamp (log);
+    /* We're in debugging mode, hence we can't invoke STACK_FILE()
+       prior to print_tstamp(), because both cause text to be written
+       to the same logfile which is expected to have the timestamp
+       first.  */
+    STACK_FILE (log);
 #endif
 
     attr[0] = '\0';
@@ -451,7 +455,7 @@ main (int argc, char **argv)
       {
         if (arg_cnt == 0 || arg_cnt > 2)
           {
-            vfprintf_diag ("%u arguments provided, expected 1-2 arguments or clean option", arg_cnt);
+            vfprintf_diag ("%u arguments provided, expected 1-2 arguments or --clean[-all]", arg_cnt);
             print_hint ();
             exit (EXIT_FAILURE);
           }
@@ -969,8 +973,9 @@ cleanup (void)
                   fclose (var->ptr);
                   break;
                 case IS_UNUSED:
-                default:
                   break;
+                default: /* never reached */
+                  ABORT_TRACE ();
               }
           }
         free_null (vars_list);
@@ -1926,7 +1931,8 @@ release (struct var_list *list, unsigned int stacked, void **ptr)
     for (i = 0; i < stacked; i++)
       {
         struct var_list *var = &list[i];
-        if (var->ptr == *ptr)
+        if (var->type != IS_UNUSED
+         && var->ptr == *ptr)
           {
             switch (var->type)
               {
@@ -1936,8 +1942,8 @@ release (struct var_list *list, unsigned int stacked, void **ptr)
                 case IS_FILE:
                   fclose (*ptr);
                   break;
-                default:
-                  break;
+                default: /* never reached */
+                  ABORT_TRACE ();
               }
             *ptr = NULL;
             var->ptr  = NULL;