From 2bf9c28c3eaedb9a9eb5fde7d518b258edeaf2c4 Mon Sep 17 00:00:00 2001 From: Charles Nicholson Date: Sun, 26 Jan 2025 16:59:09 -0500 Subject: [PATCH] hoist field width initialization to avoid LTO warning --- nanoprintf.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nanoprintf.h b/nanoprintf.h index b6fff5c..f15269f 100644 --- a/nanoprintf.h +++ b/nanoprintf.h @@ -312,12 +312,12 @@ static int npf_parse_format_spec(char const *format, npf_format_spec_t *out_spec } #if NANOPRINTF_USE_FIELD_WIDTH_FORMAT_SPECIFIERS == 1 + out_spec->field_width = 0; out_spec->field_width_opt = NPF_FMT_SPEC_OPT_NONE; if (*cur == '*') { out_spec->field_width_opt = NPF_FMT_SPEC_OPT_STAR; ++cur; } else { - out_spec->field_width = 0; while ((*cur >= '0') && (*cur <= '9')) { out_spec->field_width_opt = NPF_FMT_SPEC_OPT_LITERAL; out_spec->field_width = (out_spec->field_width * 10) + (*cur++ - '0');