diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-06-28 15:58:01 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-06-28 15:58:01 +0300 |
commit | eb6e7c7cee0c998f5b403074201992c22383a553 (patch) | |
tree | 08537200d56b35bbfffe37fa6a7c1e63855954d0 /src/main.c | |
parent | 4b66e93d434d2a4fe8fd3f277e222de768475605 (diff) | |
download | cflow-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/main.c')
-rw-r--r-- | src/main.c | 18 |
1 files changed, 9 insertions, 9 deletions
@@ -220,3 +220,3 @@ char *start_name = "main"; /* Name of start symbol */ -Consptr arglist; /* List of command line arguments */ +struct linked_list *arglist; /* List of command line arguments */ @@ -489,3 +489,3 @@ add_name(const char *name) { - append_to_list(&arglist, (void*) name); + linked_list_append(&arglist, (void*) name); } @@ -771,6 +771,7 @@ main(int argc, char **argv) - if (arglist) - /* See comment to cleanup_processor */ - for (arglist = CAR(arglist); arglist; arglist = CDR(arglist)) { - char *s = (char*)CAR(arglist); + if (arglist) { + struct linked_list_entry *p; + + for (p = arglist->head; p; p = p->next) { + char *s = (char*)p->data; if (s[0] == '-') @@ -780,3 +781,4 @@ main(int argc, char **argv) } - + } + argc -= index; @@ -792,4 +794,2 @@ main(int argc, char **argv) - cleanup(); - output(); |