lib/vsprintf.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
Use the simpler min()/max() macros since the values are all compatible.
Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
---
lib/vsprintf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 9f359b31c8d1..57ae85680536 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -1208,7 +1208,7 @@ char *hex_string(char *buf, char *end, u8 *addr, struct printf_spec spec,
}
if (spec.field_width > 0)
- len = min_t(int, spec.field_width, 64);
+ len = min(spec.field_width, 64);
for (i = 0; i < len; ++i) {
if (buf < end)
@@ -1233,7 +1233,7 @@ char *bitmap_string(char *buf, char *end, const unsigned long *bitmap,
struct printf_spec spec, const char *fmt)
{
const int CHUNKSZ = 32;
- int nr_bits = max_t(int, spec.field_width, 0);
+ int nr_bits = max(spec.field_width, 0);
int i, chunksz;
bool first = true;
@@ -1276,7 +1276,7 @@ static noinline_for_stack
char *bitmap_list_string(char *buf, char *end, const unsigned long *bitmap,
struct printf_spec spec, const char *fmt)
{
- int nr_bits = max_t(int, spec.field_width, 0);
+ int nr_bits = max(spec.field_width, 0);
bool first = true;
int rbot, rtop;
On Mon 2026-05-18 14:31:47, Thorsten Blum wrote: > Use the simpler min()/max() macros since the values are all compatible. > > --- a/lib/vsprintf.c > +++ b/lib/vsprintf.c > @@ -1208,7 +1208,7 @@ char *hex_string(char *buf, char *end, u8 *addr, struct printf_spec spec, > } > > if (spec.field_width > 0) > - len = min_t(int, spec.field_width, 64); > + len = min(spec.field_width, 64); Honestly, I do not see any big advantage in replacing the macros. In fact, the min()/max() macros are even more complex because they check compatibility of the compared types. IMHO, this adds non-necessary churn into the git history without an obvious advantage. Best Regards, Petr
© 2016 - 2026 Red Hat, Inc.