diff options
author | Cyrill Gorcunov <gorcunov@gmail.com> | 2018-11-13 01:23:47 +0300 |
---|---|---|
committer | Cyrill Gorcunov <gorcunov@gmail.com> | 2018-11-13 01:23:47 +0300 |
commit | feabd742a3520d0835428f47d474979b4566c4ce (patch) | |
tree | e1ff7d57e6aea05b21b9aad3745f2cff39ad67fc | |
parent | e35885152632ca207386dd07202a3e373c7dd60d (diff) | |
download | nasm-feabd742a3520d0835428f47d474979b4566c4ce.tar.gz nasm-feabd742a3520d0835428f47d474979b4566c4ce.tar.xz nasm-feabd742a3520d0835428f47d474979b4566c4ce.zip |
preproc_init: Just clean include path
It is more natural to keep include path valid
during the whole lifetime.
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
-rw-r--r-- | asm/nasm.c | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -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; } |