]> granicus.if.org Git - graphviz/commitdiff
cgraph delete_items: rephrase a non-exhaustive switch into if statements
authorMatthew Fernandez <matthew.fernandez@gmail.com>
Sat, 13 Aug 2022 00:50:11 +0000 (17:50 -0700)
committerMatthew Fernandez <matthew.fernandez@gmail.com>
Thu, 18 Aug 2022 03:37:42 +0000 (20:37 -0700)
This is both more concise and squashes a -Wswitch-default warning.

lib/cgraph/grammar.y

index aa93523e7d801876f80c2f53701b14619d199a16..943ba27838a94fea2c63c2afd6a31936b55e3620 100644 (file)
@@ -238,10 +238,8 @@ static void delete_items(item *ilist)
 
        for (p = ilist; p; p = pn) {
                pn = p->next;
-               switch(p->tag) {
-                       case T_list: delete_items(p->u.list); break;
-                       case T_atom: case T_attr: agstrfree(G,p->str); break;
-               }
+               if (p->tag == T_list) delete_items(p->u.list);
+               if (p->tag == T_atom) agstrfree(G,p->str);
                agfree(G,p);
        }
 }