]> granicus.if.org Git - strace/commitdiff
Trivial optimization
authorDenys Vlasenko <vda.linux@googlemail.com>
Sun, 29 Jan 2012 20:17:56 +0000 (21:17 +0100)
committerDenys Vlasenko <vda.linux@googlemail.com>
Sun, 29 Jan 2012 20:17:56 +0000 (21:17 +0100)
* strace.c (cleanup): Read 'interrupted' volatile variable only once.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
strace.c

index 8eca57aec22e1e55e7b45b9e42e3e19b19233845..b739cd62182ce6fc2860e337880f69a1213e02e7 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -1974,7 +1974,12 @@ cleanup(void)
 {
        int i;
        struct tcb *tcp;
-       int fatal_sig = interrupted ? interrupted : SIGTERM;
+       int fatal_sig;
+
+       /* 'interrupted' is a volatile object, fetch it only once */
+       fatal_sig = interrupted;
+       if (!fatal_sig)
+               fatal_sig = SIGTERM;
 
        for (i = 0; i < tcbtabsize; i++) {
                tcp = tcbtab[i];