[hackers] [scc] [driver] and move object cleaning in terminate too || Quentin Rameau

From: <git_AT_suckless.org>
Date: Fri, 17 Jun 2016 21:45:13 +0200 (CEST)

commit 86d4d2d74051defbe0d27d33ad7bda3ff39408a4
Author: Quentin Rameau <quinq_AT_fifth.space>
AuthorDate: Thu Jun 16 13:12:07 2016 +0200
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Fri Jun 17 15:45:08 2016 +0200

    [driver] and move object cleaning in terminate too
    
    atexit() is run whether there has been an error or we return normally so
    it's better to do the cleaning there!

diff --git a/driver/posix/scc.c b/driver/posix/scc.c
index d3e6b9e..8f4c78e 100644
--- a/driver/posix/scc.c
+++ b/driver/posix/scc.c
_AT_@ -57,19 +57,10 @@ static struct objects objtmp, objout;
 static int Eflag, Sflag, cflag, kflag, sflag;
 
 static void
-cleanobjects(void)
-{
- int i;
-
- for (i = 0; i < objtmp.n; ++i)
- unlink(objtmp.f[i]);
-}
-
-static void
 terminate(void)
 {
         struct tool *t;
- int tool, failed = -1;
+ int i, tool, failed = -1;
 
         for (tool = 0; tool < LAST_TOOL; ++tool) {
                 t = &tools[tool];
_AT_@ -81,6 +72,11 @@ terminate(void)
                                 unlink(t->outfile);
                 }
         }
+
+ if (!kflag) {
+ for (i = 0; i < objtmp.n; ++i)
+ unlink(objtmp.f[i]);
+ }
 }
 
 static char **
_AT_@ -465,8 +461,5 @@ main(int argc, char *argv[])
                 validatetools();
         }
 
- if (!kflag)
- cleanobjects();
-
         return 0;
 }
Received on Fri Jun 17 2016 - 21:45:13 CEST

This archive was generated by hypermail 2.3.0 : Fri Jun 17 2016 - 21:48:25 CEST