]> granicus.if.org Git - graphviz/commitdiff
Fix incorrect code that should short-circuit the analysis for colors black, white...
authorEmden Gansner <emdenrg@google.com>
Wed, 3 May 2017 16:00:37 +0000 (12:00 -0400)
committerEmden Gansner <emdenrg@google.com>
Wed, 3 May 2017 16:00:37 +0000 (12:00 -0400)
It should have been && rather than ||. Just use streq.

lib/common/colxlate.c

index 3815af52f7df8b1adae4ba95c478532baea1e308..6ed2acbf5d6c94919c40d9b7fff4d898573f5c69 100644 (file)
@@ -27,6 +27,7 @@
 #include "color.h"
 #include "colorprocs.h"
 #include "colortbl.h"
+#include "macros.h"
 #include "memory.h"
 
 static char* colorscheme;
@@ -228,9 +229,9 @@ static char* resolveColor (char* str)
     char* ss;   /* second slash */
     char* c2;   /* second char */
 
-    if ((*str == 'b') || !strncmp(str+1,"lack",4)) return str;
-    if ((*str == 'w') || !strncmp(str+1,"hite",4)) return str;
-    if ((*str == 'l') || !strncmp(str+1,"ightgrey",8)) return str;
+    if (streq(str, "black")) return str;
+    if (streq(str, "white")) return str;
+    if (streq(str, "lightgrey")) return str;
     if (*str == '/') {   /* if begins with '/' */
        c2 = str+1;
         if ((ss = strchr(c2, '/'))) {  /* if has second '/' */