From: nasm-bot f. C. G. <gor...@gm...> - 2018-11-12 22:27:26
|
Commit-ID: feabd742a3520d0835428f47d474979b4566c4ce Gitweb: http://repo.or.cz/w/nasm.git?a=commitdiff;h=feabd742a3520d0835428f47d474979b4566c4ce Author: Cyrill Gorcunov <gor...@gm...> AuthorDate: Tue, 13 Nov 2018 01:23:47 +0300 Committer: Cyrill Gorcunov <gor...@gm...> CommitDate: Tue, 13 Nov 2018 01:23:47 +0300 preproc_init: Just clean include path It is more natural to keep include path valid during the whole lifetime. Signed-off-by: Cyrill Gorcunov <gor...@gm...> --- asm/nasm.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/asm/nasm.c b/asm/nasm.c index 52df47d..9e36314 100644 --- a/asm/nasm.c +++ b/asm/nasm.c @@ -328,15 +328,18 @@ static void define_macros(void) * Command-line specified preprocessor directives (-p, -d, -u, * --pragma, --before) are processed after this function. */ -static void preproc_init(StrList *list) +static void preproc_init(StrList **ipath) { struct strlist_entry *l; preproc->init(); define_macros(); - list_for_each(l, list->head) + list_for_each(l, (*ipath)->head) preproc->include_path(l->str); + + strlist_free(*ipath); + *ipath = strlist_allocate(); } static void emit_dependencies(StrList *list) @@ -500,9 +503,7 @@ int main(int argc, char **argv) } } - preproc_init(include_path); - strlist_free(include_path); - include_path = NULL; + preproc_init(&include_path); parse_cmdline(argc, argv, 2); if (terminate_after_phase) { @@ -633,6 +634,7 @@ int main(int argc, char **argv) eval_cleanup(); stdscan_cleanup(); src_free(); + strlist_free(include_path); return terminate_after_phase; } |