[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v3 1/3] linux-user/syscall.c: do_ppoll: simplify time64 host<=>ta
From: |
Michael Tokarev |
Subject: |
[PATCH v3 1/3] linux-user/syscall.c: do_ppoll: simplify time64 host<=>target conversion expressions |
Date: |
Thu, 14 Sep 2023 10:43:35 +0300 |
replace if (time64) { time64-expr } else { time32-expr }
expressions which are difficult to read with a much shorter
and easier to read arithmetic-if constructs.
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
---
linux-user/syscall.c | 27 +++++++++------------------
1 file changed, 9 insertions(+), 18 deletions(-)
diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index 3521a2d70b..33bf84c205 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -1516,16 +1516,11 @@ static abi_long do_ppoll(abi_long arg1, abi_long arg2,
abi_long arg3,
sigset_t *set = NULL;
if (arg3) {
- if (time64) {
- if (target_to_host_timespec64(timeout_ts, arg3)) {
- unlock_user(target_pfd, arg1, 0);
- return -TARGET_EFAULT;
- }
- } else {
- if (target_to_host_timespec(timeout_ts, arg3)) {
- unlock_user(target_pfd, arg1, 0);
- return -TARGET_EFAULT;
- }
+ if (time64
+ ? target_to_host_timespec64(timeout_ts, arg3)
+ : target_to_host_timespec(timeout_ts, arg3)) {
+ unlock_user(target_pfd, arg1, 0);
+ return -TARGET_EFAULT;
}
} else {
timeout_ts = NULL;
@@ -1546,14 +1541,10 @@ static abi_long do_ppoll(abi_long arg1, abi_long arg2,
abi_long arg3,
finish_sigsuspend_mask(ret);
}
if (!is_error(ret) && arg3) {
- if (time64) {
- if (host_to_target_timespec64(arg3, timeout_ts)) {
- return -TARGET_EFAULT;
- }
- } else {
- if (host_to_target_timespec(arg3, timeout_ts)) {
- return -TARGET_EFAULT;
- }
+ if (time64
+ ? host_to_target_timespec64(arg3, timeout_ts)
+ : host_to_target_timespec(arg3, timeout_ts)) {
+ return -TARGET_EFAULT;
}
}
} else {
--
2.39.2