scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 8ce3a83e5a7de9348b55ed9f7ddcb4de0e51c82a
parent eb2bc635310842692b7b00ed6bf77f48d2584b6f
Author: Quentin Rameau <quinq@fifth.space>
Date:   Sat,  4 Jun 2016 12:28:02 +0200

[driver] remove cleanup: clean in build and terminate

Unlink failed files only on error, when terminate is called.

Diffstat:
Mdriver/posix/scc.c | 22++++------------------
1 file changed, 4 insertions(+), 18 deletions(-)

diff --git a/driver/posix/scc.c b/driver/posix/scc.c @@ -46,23 +46,6 @@ static int failedtool = NR_TOOLS; static int Eflag, Sflag, kflag; static void -cleanup(void) -{ - struct tool *t; - int i; - - for (i = 0; i < NR_TOOLS + 1; ++i) { - t = &tools[i]; - if (t->outfile) { - if (i > failedtool) - unlink(t->outfile); - free(t->outfile); - t->outfile = NULL; - } - } -} - -static void terminate(void) { struct tool *t; @@ -306,7 +289,10 @@ build(char *file) for (i = 0; i < NR_TOOLS; ++i) checktool(i); - cleanup(); + for (i = 0; i < NR_TOOLS; ++i) { + free(tools[i].outfile); + tools[i].outfile = NULL; + } } static void