summaryrefslogtreecommitdiff
path: root/lib/vsprintf.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2025-11-20 09:31:40 +0100
committerPetr Mladek <pmladek@suse.com>2025-11-24 16:10:11 +0100
commita9f349e3c0bebe7ae97750b32a72f452bdf707e2 (patch)
tree69d733f0361eb21af7949e25924ffa1b309458bd /lib/vsprintf.c
parent376c18f30e226854062ff0a6eebc6af4ea62456b (diff)
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>
Diffstat (limited to 'lib/vsprintf.c')
-rw-r--r--lib/vsprintf.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/vsprintf.c b/lib/vsprintf.c
index 11dbf1023391..0dffc7224d41 100644
--- a/lib/vsprintf.c
+++ b/lib/vsprintf.c
@@ -2877,10 +2877,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;
}
@@ -3388,11 +3389,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;
}