X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/b9f1d9a47a49c40e8f0a5006b492daba53f25b20..dd31e17d7e415d3be8fc603f752f7e975297bcc2:/src/symlist.c?ds=sidebyside diff --git a/src/symlist.c b/src/symlist.c index 974d974c..874e238a 100644 --- a/src/symlist.c +++ b/src/symlist.c @@ -1,6 +1,7 @@ /* Lists of symbols for Bison - Copyright (C) 2002, 2005, 2006, 2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2005-2007, 2009-2012 Free Software Foundation, + Inc. This file is part of Bison, the GNU Compiler Compiler. @@ -122,7 +123,7 @@ symbol_list_syms_print (const symbol_list *l, FILE *f) symbol_print (l->content.sym, f); fprintf (stderr, l->action_props.is_value_used ? " used" : " unused"); if (l && l->content.sym) - fprintf (f, ", "); + fprintf (f, ", "); } } @@ -146,7 +147,13 @@ symbol_list_prepend (symbol_list *list, symbol_list *node) void symbol_list_free (symbol_list *list) { - LIST_FREE (symbol_list, list); + symbol_list *node, *next; + for (node = list; node; node = next) + { + next = node->next; + named_ref_free (node->named_ref); + free (node); + } } @@ -183,7 +190,7 @@ symbol_list_n_get (symbol_list *l, int n) l = l->next; if (l == NULL || (l->content_type == SYMLIST_SYMBOL && l->content.sym == NULL)) - return NULL; + return NULL; } return l; @@ -208,6 +215,12 @@ symbol_list_n_type_name_get (symbol_list *l, location loc, int n) return l->content.sym->type_name; } +bool +symbol_list_null (symbol_list *node) +{ + return !node || + (node->content_type == SYMLIST_SYMBOL && !(node->content.sym)); +} void symbol_list_destructor_set (symbol_list *node, char const *code, location loc)