]> git.refcnt.org Git - colorize.git/commitdiff
Make assertions more explicit
authorSteven Schubiger <stsc@refcnt.org>
Fri, 4 Aug 2017 19:31:12 +0000 (21:31 +0200)
committerSteven Schubiger <stsc@refcnt.org>
Fri, 4 Aug 2017 19:31:12 +0000 (21:31 +0200)
colorize.c

index 8c0afcbe36725ea6402a63ec77b3d1fa05f9126b..a443368c7b66148842b3b406d143e56826d89381 100644 (file)
@@ -649,7 +649,7 @@ process_args (unsigned int arg_cnt, char **arg_strings, char *attr, const struct
     const char *color_string = arg_cnt >= 1 ? arg_strings[0] : NULL;
     const char *file_string  = arg_cnt == 2 ? arg_strings[1] : NULL;
 
-    assert (color_string);
+    assert (color_string != NULL);
 
     if (streq (color_string, "-"))
       {
@@ -678,7 +678,7 @@ process_args (unsigned int arg_cnt, char **arg_strings, char *attr, const struct
 
     gather_color_names (color_string, attr, color_names);
 
-    assert (color_names[FOREGROUND]);
+    assert (color_names[FOREGROUND] != NULL);
 
     if (color_names[BACKGROUND])
       {
@@ -739,8 +739,8 @@ process_file_arg (const char *file_string, const char **file, FILE **stream)
         *file = "stdin";
       }
 
-    assert (*stream);
-    assert (*file);
+    assert (*stream != NULL);
+    assert (*file != NULL);
 }
 
 static void
@@ -814,7 +814,7 @@ gather_color_names (const char *color_string, char *attr, struct color_name **co
           }
         else
           p = color + strlen (color);
-        assert (p);
+        assert (p != NULL);
 
         for (ch = color; *ch; ch++)
           if (!isalpha (*ch))