[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 34/48] bsd-user: style tweak: don't assign in if statements
From: |
imp |
Subject: |
[PATCH v2 34/48] bsd-user: style tweak: don't assign in if statements |
Date: |
Sat, 24 Apr 2021 10:00:02 -0600 |
From: Warner Losh <imp@bsdimp.com>
Signed-off-by: Warner Losh <imp@bsdimp.com>
---
bsd-user/qemu.h | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 7f3cfa68aa..2494d9209d 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -288,7 +288,8 @@ static inline bool access_ok(int type, abi_ulong addr,
abi_ulong size)
abi_ulong __gaddr = (gaddr); \
target_type *__hptr; \
abi_long __ret; \
- if ((__hptr = lock_user(VERIFY_WRITE, __gaddr, sizeof(target_type), 0))) {
\
+ __hptr = lock_user(VERIFY_WRITE, __gaddr, sizeof(target_type), 0); \
+ if (__hptr) { \
__ret = __put_user((x), __hptr); \
unlock_user(__hptr, __gaddr, sizeof(target_type)); \
} else \
@@ -301,7 +302,8 @@ static inline bool access_ok(int type, abi_ulong addr,
abi_ulong size)
abi_ulong __gaddr = (gaddr); \
target_type *__hptr; \
abi_long __ret; \
- if ((__hptr = lock_user(VERIFY_READ, __gaddr, sizeof(target_type), 1))) { \
+ __hptr = lock_user(VERIFY_READ, __gaddr, sizeof(target_type), 1); \
+ if (__hptr) { \
__ret = __get_user((x), __hptr); \
unlock_user(__hptr, __gaddr, 0); \
} else { \
--
2.22.1
- [PATCH v2 27/48] bsd-user: style tweak: space pedantry, (continued)
- [PATCH v2 27/48] bsd-user: style tweak: space pedantry, imp, 2021/04/24
- [PATCH v2 35/48] bsd-user: style tweak: use {} for all if statements, format else correctly, imp, 2021/04/24
- [PATCH v2 30/48] bsd-user: style tweak: fix block comments, imp, 2021/04/24
- [PATCH v2 36/48] bsd-user: style tweak: Use preferred block comments, imp, 2021/04/24
- [PATCH v2 46/48] bsd-user: style tweak: Return is not a function call., imp, 2021/04/24
- [PATCH v2 34/48] bsd-user: style tweak: don't assign in if statements,
imp <=
- [PATCH v2 47/48] bsd-user: style tweak: don't assign in if statement., imp, 2021/04/24
- Re: [PATCH v2 00/48] bsd-user style and reorg patches, no-reply, 2021/04/24