APPEND(arg->op);
APPEND(" ");
APPEND(arg->param);
-
- /* Remove this element from the list and free it. */
- TAILQ_REMOVE(&pp->cpp_args, arg, entry);
- yasm_xfree(arg->param);
- yasm_xfree(arg);
}
/* Append final arguments. */
cmdline = cpp_build_cmdline(pp);
-#if 0
- /* Print the command line before executing. */
- printf("%s\n", cmdline);
-#endif
-
pp->f = popen(cmdline, "r");
if (!pp->f)
yasm__fatal( N_("Failed to execute preprocessor") );
yasm_xfree(cmdline);
}
+/* Free memory used by the list of arguments. */
+static void
+cpp_destroy_args(yasm_preproc_cpp *pp)
+{
+ cpp_arg_entry *arg;
+
+ while ( (arg = TAILQ_FIRST(&pp->cpp_args)) ) {
+ TAILQ_REMOVE(&pp->cpp_args, arg, entry);
+ yasm_xfree(arg->param);
+ yasm_xfree(arg);
+ }
+}
+
/*******************************************************************************
Interface functions.
*******************************************************************************/
yasm__fatal( N_("Preprocessor exited with failure") );
}
+ cpp_destroy_args(pp);
+
yasm_xfree(pp->filename);
yasm_xfree(pp);
}