Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Andy Shevchenko and committed by
Petr Mladek
a9f349e3 376c18f3

+6 -6
+6 -6
lib/vsprintf.c
··· 2877 2877 2878 2878 case FORMAT_STATE_NUM: { 2879 2879 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)) 2883 2882 num = va_arg(args, long long); 2883 + else 2884 + num = convert_num_spec(va_arg(args, int), fmt.size, spec); 2884 2885 str = number(str, end, num, spec); 2885 2886 continue; 2886 2887 } ··· 3389 3388 goto out; 3390 3389 3391 3390 case FORMAT_STATE_NUM: 3392 - if (fmt.size > sizeof(int)) { 3391 + if (fmt.size > sizeof(int)) 3393 3392 num = get_arg(long long); 3394 - } else { 3393 + else 3395 3394 num = convert_num_spec(get_arg(int), fmt.size, spec); 3396 - } 3397 3395 str = number(str, end, num, spec); 3398 3396 continue; 3399 3397 }