]> granicus.if.org Git - graphviz/commitdiff
remove a strcmp micro-optimization
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 20 Mar 2021 00:48:30 +0000 (17:48 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Sun, 28 Mar 2021 22:58:00 +0000 (15:58 -0700)
lib/neatogen/neatoinit.c

index 3c43719e28359ce9bf4b7f3524d2d4e5c5d043e1..2e4ff71b411a88bedd9b567e072d021c4be9f1f6 100644 (file)
@@ -620,19 +620,16 @@ static void neato_init_graph (Agraph_t * g)
 static int neatoModel(graph_t * g)
 {
     char *p = agget(g, "model");
-    char c;
 
-    if (!p || (!(c = *p)))    /* if p is NULL or "" */
+    if (!p || streq(p, ""))    /* if p is NULL or "" */
        return MODEL_SHORTPATH;
-    if ((c == 'c') && streq(p, "circuit"))
+    if (streq(p, "circuit"))
        return MODEL_CIRCUIT;
-    if (c == 's') {
-       if (streq(p, "subset"))
-           return MODEL_SUBSET;
-       else if (streq(p, "shortpath"))
-           return MODEL_SHORTPATH;
-    }
-    if ((c == 'm') && streq(p, "mds")) {
+    if (streq(p, "subset"))
+       return MODEL_SUBSET;
+    if (streq(p, "shortpath"))
+       return MODEL_SHORTPATH;
+    if (streq(p, "mds")) {
        if (agattr(g, AGEDGE, "len", 0))
            return MODEL_MDS;
        else {
@@ -656,7 +653,7 @@ static int neatoMode(graph_t * g)
     int mode = MODE_MAJOR;     /* default mode */
 
     str = agget(g, "mode");
-    if (str && *str) {
+    if (str && !streq(str, "")) {
        if (streq(str, "KK"))
            mode = MODE_KK;
        else if (streq(str, "major"))