From: Matthew Fernandez Date: Sat, 13 Aug 2022 00:50:11 +0000 (-0700) Subject: cgraph delete_items: rephrase a non-exhaustive switch into if statements X-Git-Tag: 5.0.1~6^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a43625651178d33c9e1bf5fc5779115af16b7ce7;p=graphviz cgraph delete_items: rephrase a non-exhaustive switch into if statements This is both more concise and squashes a -Wswitch-default warning. --- diff --git a/lib/cgraph/grammar.y b/lib/cgraph/grammar.y index aa93523e7..943ba2783 100644 --- a/lib/cgraph/grammar.y +++ b/lib/cgraph/grammar.y @@ -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); } }