aboutsummaryrefslogtreecommitdiff
path: root/src/main.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/main.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/main.c')
-rw-r--r--src/main.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main.c b/src/main.c
index cbb472e..b08ccdd 100644
--- a/src/main.c
+++ b/src/main.c
@@ -218,7 +218,7 @@ int preprocess_option = 0; /* Do they want to preprocess sources? */
char *start_name = "main"; /* Name of start symbol */
-Consptr arglist; /* List of command line arguments */
+struct linked_list *arglist; /* List of command line arguments */
/* Given the option_type array and (possibly abbreviated) option argument
* find the type corresponding to that argument.
@@ -487,7 +487,7 @@ set_level_indent(const char *str)
static void
add_name(const char *name)
{
- append_to_list(&arglist, (void*) name);
+ linked_list_append(&arglist, (void*) name);
}
static void
@@ -769,15 +769,17 @@ main(int argc, char **argv)
init();
- 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] == '-')
pp_option(s);
else if (source(s) == 0)
yyparse();
}
+ }
argc -= index;
argv += index;
@@ -790,8 +792,6 @@ main(int argc, char **argv)
if (input_file_count == 0)
error(1, 0, _("no input files"));
- cleanup();
-
output();
return 0;
}

Return to:

Send suggestions and report system problems to the System administrator.