aboutsummaryrefslogtreecommitdiff
path: root/bsd-user/qemu.h
diff options
context:
space:
mode:
authorWarner Losh <imp@bsdimp.com>2021-04-23 19:55:03 -0600
committerWarner Losh <imp@bsdimp.com>2021-05-11 11:07:21 -0600
commitcb0ea0197f17bc6ed4a21e3c872d440501f055f0 (patch)
treeabcc14d6b9d66324ae7efd03e8ae5dfb5980d9ce /bsd-user/qemu.h
parent3306693438c8ee770dca7ca5a365848d7bceef55 (diff)
downloadqemu-cb0ea0197f17bc6ed4a21e3c872d440501f055f0.zip
qemu-cb0ea0197f17bc6ed4a21e3c872d440501f055f0.tar.gz
qemu-cb0ea0197f17bc6ed4a21e3c872d440501f055f0.tar.bz2
bsd-user: style tweak: use {} for all if statements, format else correctly
Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Signed-off-by: Warner Losh <imp@bsdimp.com>
Diffstat (limited to 'bsd-user/qemu.h')
-rw-r--r--bsd-user/qemu.h20
1 files changed, 13 insertions, 7 deletions
diff --git a/bsd-user/qemu.h b/bsd-user/qemu.h
index 2494d92..8d37679 100644
--- a/bsd-user/qemu.h
+++ b/bsd-user/qemu.h
@@ -358,16 +358,18 @@ abi_long copy_to_user(abi_ulong gaddr, void *hptr, size_t len);
static inline void *lock_user(int type, abi_ulong guest_addr, long len,
int copy)
{
- if (!access_ok(type, guest_addr, len))
+ if (!access_ok(type, guest_addr, len)) {
return NULL;
+ }
#ifdef DEBUG_REMAP
{
void *addr;
addr = g_malloc(len);
- if (copy)
+ if (copy) {
memcpy(addr, g2h_untagged(guest_addr), len);
- else
+ } else {
memset(addr, 0, len);
+ }
return addr;
}
#else
@@ -384,12 +386,15 @@ static inline void unlock_user(void *host_ptr, abi_ulong guest_addr,
{
#ifdef DEBUG_REMAP
- if (!host_ptr)
+ if (!host_ptr) {
return;
- if (host_ptr == g2h_untagged(guest_addr))
+ }
+ if (host_ptr == g2h_untagged(guest_addr)) {
return;
- if (len > 0)
+ }
+ if (len > 0) {
memcpy(g2h_untagged(guest_addr), host_ptr, len);
+ }
g_free(host_ptr);
#endif
}
@@ -405,8 +410,9 @@ static inline void *lock_user_string(abi_ulong guest_addr)
{
abi_long len;
len = target_strlen(guest_addr);
- if (len < 0)
+ if (len < 0) {
return NULL;
+ }
return lock_user(VERIFY_READ, guest_addr, (long)(len + 1), 1);
}