From a43625651178d33c9e1bf5fc5779115af16b7ce7 Mon Sep 17 00:00:00 2001 From: Matthew Fernandez Date: Fri, 12 Aug 2022 17:50:11 -0700 Subject: [PATCH] cgraph delete_items: rephrase a non-exhaustive switch into if statements This is both more concise and squashes a -Wswitch-default warning. --- lib/cgraph/grammar.y | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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); } } -- 2.40.0