Skip to content

Commit a9f349e

Browse files
andy-shevpmladek
authored andcommitted
lib/vsprintf: Unify FORMAT_STATE_NUM handlers
We have two almost identical pieces that handle FORMAT_STATE_NUM case. The differences are: - redundant {} for one-line if-else conditional - missing blank line after variable definitions - inverted conditional Unify the style of two. Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Link: https://patch.msgid.link/20251120083140.3478507-1-andriy.shevchenko@linux.intel.com Signed-off-by: Petr Mladek <pmladek@suse.com>
1 parent 376c18f commit a9f349e

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

lib/vsprintf.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2877,10 +2877,11 @@ int vsnprintf(char *buf, size_t size, const char *fmt_str, va_list args)
28772877

28782878
case FORMAT_STATE_NUM: {
28792879
unsigned long long num;
2880-
if (fmt.size <= sizeof(int))
2881-
num = convert_num_spec(va_arg(args, int), fmt.size, spec);
2882-
else
2880+
2881+
if (fmt.size > sizeof(int))
28832882
num = va_arg(args, long long);
2883+
else
2884+
num = convert_num_spec(va_arg(args, int), fmt.size, spec);
28842885
str = number(str, end, num, spec);
28852886
continue;
28862887
}
@@ -3388,11 +3389,10 @@ int bstr_printf(char *buf, size_t size, const char *fmt_str, const u32 *bin_buf)
33883389
goto out;
33893390

33903391
case FORMAT_STATE_NUM:
3391-
if (fmt.size > sizeof(int)) {
3392+
if (fmt.size > sizeof(int))
33923393
num = get_arg(long long);
3393-
} else {
3394+
else
33943395
num = convert_num_spec(get_arg(int), fmt.size, spec);
3395-
}
33963396
str = number(str, end, num, spec);
33973397
continue;
33983398
}

0 commit comments

Comments
 (0)