]> granicus.if.org Git - strace/commitdiff
ptrace_restart: cleanup
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 23 Dec 2016 23:39:35 +0000 (23:39 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Sat, 24 Dec 2016 14:58:39 +0000 (14:58 +0000)
* strace.c (ptrace_restart): Replace the sequence of "if" statements
with a "switch" statement.

strace.c

index ac9ff7f9d734b2f8caf187f7e0df0c06d6d53925..91589555aad71b1772a4179f2b4f30c86322e998 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -397,13 +397,20 @@ ptrace_restart(const unsigned int op, struct tcb *const tcp, unsigned int sig)
        if (!err)
                return 0;
 
-       msg = "SYSCALL";
-       if (op == PTRACE_CONT)
-               msg = "CONT";
-       if (op == PTRACE_DETACH)
-               msg = "DETACH";
-       if (op == PTRACE_LISTEN)
-               msg = "LISTEN";
+       switch (op) {
+               case PTRACE_CONT:
+                       msg = "CONT";
+                       break;
+               case PTRACE_DETACH:
+                       msg = "DETACH";
+                       break;
+               case PTRACE_LISTEN:
+                       msg = "LISTEN";
+                       break;
+               default:
+                       msg = "SYSCALL";
+       }
+
        /*
         * Why curcol != 0? Otherwise sometimes we get this:
         *