From: Emden Gansner Date: Wed, 3 May 2017 16:00:37 +0000 (-0400) Subject: Fix incorrect code that should short-circuit the analysis for colors black, white... X-Git-Tag: 2.42.0~178 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1bf033d2979b07416c4f42e09b90db133d88b877;p=graphviz Fix incorrect code that should short-circuit the analysis for colors black, white and lightgrey. It should have been && rather than ||. Just use streq. --- diff --git a/lib/common/colxlate.c b/lib/common/colxlate.c index 3815af52f..6ed2acbf5 100644 --- a/lib/common/colxlate.c +++ b/lib/common/colxlate.c @@ -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 '/' */