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 <[email protected]>
---
 builtins/printf.def | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/builtins/printf.def b/builtins/printf.def
index 7d7f8c2..f7abf53 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


Reply via email to