diff options
| author | ktullavik <ktullavik@gmail.com> | 2024-10-17 17:25:57 +0000 |
|---|---|---|
| committer | Warner Losh <imp@FreeBSD.org> | 2025-05-06 22:01:45 +0000 |
| commit | 171e3706e477076047f7a9dbe4603d2542bb9e65 (patch) | |
| tree | 04ea1473ac014bc78007ce23867b8fde3f969607 | |
| parent | f8aa0ee8d017a276d22521fa7c809aa0f3349be2 (diff) | |
devinfo: Unwind the ternary operator to better fit future libxo structure
No functional change intended.
Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1480
| -rw-r--r-- | usr.sbin/devinfo/devinfo.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/usr.sbin/devinfo/devinfo.c b/usr.sbin/devinfo/devinfo.c index 306d752e884e..4343c7dd3457 100644 --- a/usr.sbin/devinfo/devinfo.c +++ b/usr.sbin/devinfo/devinfo.c @@ -80,13 +80,21 @@ print_resource(struct devinfo_res *res) { struct devinfo_rman *rman; bool hexmode; + rman_res_t end; rman = devinfo_handle_to_rman(res->dr_rman); hexmode = (rman->dm_size > 1000) || (rman->dm_size == 0); - printf(hexmode ? "0x%jx" : "%ju", res->dr_start); - if (res->dr_size > 1) - printf(hexmode ? "-0x%jx" : "-%ju", - res->dr_start + res->dr_size - 1); + end = res->dr_start + res->dr_size - 1; + + if (hexmode) { + printf("0x%jx", res->dr_start); + if (res->dr_size > 1) + printf("-0x%jx", end); + } else { + printf("%ju", res->dr_start); + if (res->dr_size > 1) + printf("-%ju", end); + } } /* |
