diff options
author | Pali Rohár <pali@kernel.org> | 2021-11-20 13:43:35 +0100 |
---|---|---|
committer | Martin Mares <mj@ucw.cz> | 2022-02-10 13:49:35 +0100 |
commit | 3b26eaa884987a828421415559aaf61772839fed (patch) | |
tree | 83944b4f892a3ad3714bee8944d2795dacfc59c0 | |
parent | 66a85e51e61f84452ba8b90a53f0c0037b21fdf6 (diff) | |
download | pciutils-3b26eaa884987a828421415559aaf61772839fed.tar.gz |
lspci: Simplify printing range in show_range()
Use just one printf() call with width format argument based on number of bits.
-rw-r--r-- | lspci.c | 7 |
1 files changed, 1 insertions, 6 deletions
@@ -378,12 +378,7 @@ show_range(char *prefix, u64 base, u64 limit, int bits) { printf("%s:", prefix); if (base <= limit || verbose > 2) - { - if (bits > 32) - printf(" %016" PCI_U64_FMT_X "-%016" PCI_U64_FMT_X, base, limit); - else - printf(" %08x-%08x", (unsigned) base, (unsigned) limit); - } + printf(" %0*" PCI_U64_FMT_X "-%0*" PCI_U64_FMT_X, (bits+3)/4, base, (bits+3)/4, limit); if (base <= limit) show_size(limit - base + 1); else |