[hackers] [scc] [driver] remove cleanup: clean in build and terminate || Quentin Rameau

From: <git_AT_suckless.org>
Date: Sat, 4 Jun 2016 13:02:20 +0200 (CEST)

commit 8ce3a83e5a7de9348b55ed9f7ddcb4de0e51c82a
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Sat Jun 4 12:28:02 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Sat Jun 4 12:40:16 2016 +0200

    [driver] remove cleanup: clean in build and terminate
    
    Unlink failed files only on error, when terminate is called.

diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index f164faf..098090d 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
_AT_@ -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;
_AT_@ -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
Received on Sat Jun 04 2016 - 13:02:20 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 04 2016 - 13:12:19 CEST