[PATCH v2 1/4] builtins/printf.def: fix build when HANDLE_MULTIBYTE is u
From:
Shubham Chakraborty
Subject:
[PATCH v2 1/4] builtins/printf.def: fix build when HANDLE_MULTIBYTE is undefined
Date:
Tue, 14 Jul 2026 16:01:44 +0530
The local variable mb_cur_max is only declared when HANDLE_MULTIBYTE is
defined, but it is assigned MB_CUR_MAX unconditionally, leading to a
compilation error when multibyte support is disabled.
Wrap the assignment in the same HANDLE_MULTIBYTE guard used for the
declaration and other usages in the function.
Signed-off-by: Shubham Chakraborty <chakrabortyshubham66@gmail.com>
---
builtins/printf.def | 2 ++
1 file changed, 2 insertions(+)
diff --git a/builtins/printf.def b/builtins/printf.def
index 7d7f8c26..f7abf53d 100644
--- a/builtins/printf.def
+++ b/builtins/printf.def
@@ -355,7 +355,9 @@ printf_builtin (WORD_LIST *list)
garglist = orig_arglist = list->next;
+#if defined (HANDLE_MULTIBYTE)
mb_cur_max = MB_CUR_MAX;
+#endif
/* Basic algorithm is to scan the format string for conversion
specifications -- once one is found, find out if the field
--
2.55.0