diff options
Diffstat (limited to 'src/parser.c')
-rw-r--r-- | src/parser.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/parser.c b/src/parser.c index 911bf58..26ac25d 100644 --- a/src/parser.c +++ b/src/parser.c @@ -1,8 +1,8 @@ /* This file is part of GNU cflow - Copyright (C) 1997, 2005, 2006, 2007 Sergey Poznyakoff + Copyright (C) 1997, 2005, 2006, 2007, 2009 Sergey Poznyakoff GNU cflow is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. @@ -1074,13 +1074,15 @@ add_reference(char *name, int line) if (sp->storage == AutoStorage || (sp->storage == StaticStorage && globals_only())) return NULL; refptr = xmalloc(sizeof(*refptr)); refptr->source = filename; refptr->line = line; - append_to_list(&sp->ref_line, refptr); + if (!sp->ref_line) + sp->ref_line = linked_list_create(free); + linked_list_append(&sp->ref_line, refptr); return sp; } void call(char *name, int line) @@ -1091,26 +1093,26 @@ call(char *name, int line) if (!sp) return; if (sp->arity < 0) sp->arity = 0; if (caller) { if (!symbol_in_list(caller, sp->caller)) - append_to_list(&sp->caller, caller); + linked_list_append(&sp->caller, caller); if (!symbol_in_list(sp, caller->callee)) - append_to_list(&caller->callee, sp); + linked_list_append(&caller->callee, sp); } } void reference(char *name, int line) { Symbol *sp = add_reference(name, line); if (!sp) return; if (caller) { if (!symbol_in_list(caller, sp->caller)) - append_to_list(&sp->caller, caller); + linked_list_append(&sp->caller, caller); if (!symbol_in_list(sp, caller->callee)) - append_to_list(&caller->callee, sp); + linked_list_append(&caller->callee, sp); } } |