Improve code readability by avoiding assignments inside if()
* desc.c (decode_select): Move assignment out of if() condition.
* file.c (sprinttime): Likewise.
(sys_getdirentries): Likewise.
* io.c (sys_ioctl): Likewise.
* strace.c (test_ptrace_setoptions_followfork): Likewise.
(main): Likewise.
(proc_open): Likewise.
(detach): Likewise.
(proc_poll): Likewise.
(trace): Likewise.
* syscall.c (qualify): Likewise.
(sys_indir): Likewise.
* test/procpollable.c (main): Likewise.
* test/sfd.c (main): Likewise.
* time.c (printtv_bitness): Likewise.
(sprinttv): Likewise.
(print_timespec): Likewise.
(void sprint_timespec): Likewise.
(printitv_bitness): Likewise.
* util.c (dumpstr): Likewise.
(umovestr): Likewise.
(fixvfork): Likewise.
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
diff --git a/syscall.c b/syscall.c
index e22e391..cbe9f12 100644
--- a/syscall.c
+++ b/syscall.c
@@ -470,7 +470,8 @@
for (i = 0; i < MAX_QUALS; i++) {
qualify_one(i, opt->bitflag, !not, -1);
}
- if (!(copy = strdup(s))) {
+ copy = strdup(s);
+ if (!copy) {
fprintf(stderr, "out of memory\n");
exit(1);
}
@@ -2775,7 +2776,8 @@
int i, scno, nargs;
if (entering(tcp)) {
- if ((scno = tcp->u_arg[0]) > nsyscalls) {
+ scno = tcp->u_arg[0];
+ if (scno > nsyscalls) {
fprintf(stderr, "Bogus syscall: %u\n", scno);
return 0;
}