This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new 7877d3eb0d6 libs/libc/stream: Fix the shadowed len in
vsprintf_internal().
7877d3eb0d6 is described below
commit 7877d3eb0d6d61e25cbbbc1c40b6783b04a4fa49
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Oct 30 15:22:56 2026 +0100
libs/libc/stream: Fix the shadowed len in vsprintf_internal().
fee2c2e9705 ("libc/stdio: Batch vsprintf literal output") added two
inner variables `size_t len`, which shadow the `unsigned char len` of
vsprintf_internal(). arm64 builds with -Wshadow -Werror
(arch/arm64/src/Toolchain.defs), so every arm64 build failed:
stream/lib_libvsprintf.c:219:26: error: declaration of 'len' shadows
a previous local [-Werror=shadow]
Rename the two inner variables to litlen. No functional change.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
libs/libc/stream/lib_libvsprintf.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/libs/libc/stream/lib_libvsprintf.c
b/libs/libc/stream/lib_libvsprintf.c
index cef1731b8c8..c64d30c6365 100644
--- a/libs/libc/stream/lib_libvsprintf.c
+++ b/libs/libc/stream/lib_libvsprintf.c
@@ -216,11 +216,11 @@ static int vsprintf_internal(FAR struct lib_outstream_s
*stream,
if (stream != NULL)
#endif
{
- size_t len = (fmt - start) - 1;
+ size_t litlen = (fmt - start) - 1;
- if (len > 0)
+ if (litlen > 0)
{
- stream_puts(start, len, stream);
+ stream_puts(start, litlen, stream);
}
}
@@ -229,7 +229,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s
*stream,
if (c == '%')
{
- size_t len = (fmt - start) - 1;
+ size_t litlen = (fmt - start) - 1;
c = fmt_char(fmt);
if (c != '%')
@@ -238,9 +238,9 @@ static int vsprintf_internal(FAR struct lib_outstream_s
*stream,
if (stream != NULL)
#endif
{
- if (len > 0)
+ if (litlen > 0)
{
- stream_puts(start, len, stream);
+ stream_puts(start, litlen, stream);
}
}
@@ -251,7 +251,7 @@ static int vsprintf_internal(FAR struct lib_outstream_s
*stream,
if (stream != NULL)
#endif
{
- stream_puts(start, len + 1, stream);
+ stream_puts(start, litlen + 1, stream);
}
start = fmt;