aboutsummaryrefslogtreecommitdiff
path: root/src/parser.c
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2009-06-28 15:58:01 +0300
committerSergey Poznyakoff <gray@gnu.org.ua>2009-06-28 15:58:01 +0300
commiteb6e7c7cee0c998f5b403074201992c22383a553 (patch)
tree08537200d56b35bbfffe37fa6a7c1e63855954d0 /src/parser.c
parent4b66e93d434d2a4fe8fd3f277e222de768475605 (diff)
downloadcflow-eb6e7c7cee0c998f5b403074201992c22383a553.tar.gz
cflow-eb6e7c7cee0c998f5b403074201992c22383a553.tar.bz2
Provide a general-purpose type for singly-linked list.
* src/cflow.h (Cons, Consptr, CAR, CDR): Remove (struct linked_list_entry): New type. (struct linked_list): New type. (linked_list_free_data_fp): New typedef. (struct symbol): Change types of ref_line, callee and caller to struct linked_list. All usages changed. (linked_list_head): New define. (linked_list_create, linked_list_destroy) (linked_list_append, linked_list_prepend): New prototypes. (cleanup, append_to_list): Remove * src/main.c (arglist): Change type to struct linked_list * src/output.c, src/parser.c, src/symbol.c: Use new linked list functions.
Diffstat (limited to 'src/parser.c')
-rw-r--r--src/parser.c14
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,5 +1,5 @@
/* 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
@@ -1077,7 +1077,9 @@ add_reference(char *name, int line)
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;
}
@@ -1094,9 +1096,9 @@ call(char *name, int line)
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);
}
}
@@ -1108,9 +1110,9 @@ reference(char *name, int line)
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);
}
}

Return to:

Send suggestions and report system problems to the System administrator.