summaryrefslogtreecommitdiff
path: root/treesource.c
diff options
context:
space:
mode:
authorDavid Gibson <david@gibson.dropbear.id.au>2008-03-06 12:45:41 +1100
committerJon Loeliger <jdl@loeliger.com>2008-03-23 08:00:33 -0500
commit8a88ad8badfe54d91b35c5da25889de0db54f43e (patch)
treeb3966433a4ac369d7ed12067f6c1abe1eb053669 /treesource.c
parentf7ea3708c38bd38851baafa83e98d95602e53cbc (diff)
downloaddtc-8a88ad8badfe54d91b35c5da25889de0db54f43e.tar.gz
dtc: Remove ugly include stack abuse
Currently, dt_from_source() uses push_input_file() to set up the initial input file for the lexer. That sounds sensible - put the outermost input file at the bottom of the stack - until you realise that what it *actually* does is pushes the current, uninitialized, lexer input state onto the stack, then sets up the new lexer input. That necessitates an extra check in pop_input_file(), rather than signalling termination in the natural way when the include stack is empty, it has to check when it pops the bogus uninitialized state off the stack. Ick. With that fixed, push_input_file(), pop_input_file() and incl_file_stack itself become local to the lexer, so make them static. Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Diffstat (limited to 'treesource.c')
-rw-r--r--treesource.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/treesource.c b/treesource.c
index 9cbf0a9..3c24e7f 100644
--- a/treesource.c
+++ b/treesource.c
@@ -32,7 +32,8 @@ struct boot_info *dt_from_source(const char *fname)
the_boot_info = NULL;
treesource_error = 0;
- push_input_file(fname);
+ srcpos_file = dtc_open_file(fname, NULL);
+ yyin = srcpos_file->file;
if (yyparse() != 0)
return NULL;