From: Dmitry V. Levin Date: Fri, 23 Dec 2016 23:39:35 +0000 (+0000) Subject: ptrace_restart: cleanup X-Git-Tag: v4.16~252 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=08680932286b2604a4df38ebd9be8434ad898541;p=strace ptrace_restart: cleanup * strace.c (ptrace_restart): Replace the sequence of "if" statements with a "switch" statement. --- diff --git a/strace.c b/strace.c index ac9ff7f9..91589555 100644 --- 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: *