Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 6 May 2025 22:02:13 GMT
From:      Warner Losh <imp@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 171e3706e477 - main - devinfo: Unwind the ternary operator to better fit future libxo structure
Message-ID:  <202505062202.546M2Dgm042201@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by imp:

URL: https://cgit.FreeBSD.org/src/commit/?id=171e3706e477076047f7a9dbe4603d2542bb9e65

commit 171e3706e477076047f7a9dbe4603d2542bb9e65
Author:     ktullavik <ktullavik@gmail.com>
AuthorDate: 2024-10-17 17:25:57 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2025-05-06 22:01:45 +0000

    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
---
 usr.sbin/devinfo/devinfo.c | 16 ++++++++++++----
 1 file 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);
+	}
 }
 
 /*



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202505062202.546M2Dgm042201>