lib/vsprintf: Unify FORMAT_STATE_NUM handlers
Subsystems (2)
Andy Shevchenko
reviewerPATCH 1/1 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.
--- lib/vsprintf.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
lib/vsprintf.c +6 -6
@@ -3015,10 +3015,11 @@ int vsnprintf(char *buf, size_t size, const char *fmt_str, va_list args)case FORMAT_STATE_NUM : {unsigned long long num; -if (fmt.size <=sizeof (int )) - num =convert_num_spec (va_arg (args, int), fmt.size, spec); -else + +if (fmt.size >sizeof (int )) num = va_arg(args, long long); +else + num =convert_num_spec (va_arg (args, int), fmt.size, spec); str =number (str, end, num, spec);continue ; }
@@ -3526,11 +3527,10 @@ int bstr_printf(char *buf, size_t size, const char *fmt_str, const u32 *bin_buf) goto out;case FORMAT_STATE_NUM : -if (fmt.size >sizeof (int )) { +if (fmt.size >sizeof (int )) num = get_arg(long long); - }else { +else num =convert_num_spec (get_arg (int), fmt.size, spec); - } str =number (str, end, num, spec);continue ; }
Signature · 1 line
2.50.1
Quoted 9 lines · Andy Shevchenko
We have two almost identical pieces that handle
FORMAT_STATE_NUMcase. The differences are:
- redundant {} for one-line if-else conditional
- missing blank line after variable definitions
- inverted conditionalUnify the style of two.
Signed-off-by Andy Shevchenko <[email protected]>
Looks good to me:
It is a trivial change. I am going to push it right away...
Best Regards,
Petr
Petr Mladek
maintainerQuoted 9 lines · Andy Shevchenko
We have two almost identical pieces that handle
FORMAT_STATE_NUMcase. The differences are:
- redundant {} for one-line if-else conditional
- missing blank line after variable definitions
- inverted conditionalUnify the style of two.
Signed-off-by Andy Shevchenko <[email protected]>
JFYI, the patch has been comitted into printk/linux.git, branch for-6.19.
Best Regards,
Petr