From: Richard Henderson <richard.henderson@linaro.org>
To: "Philippe Mathieu-Daudé" <philmd@linaro.org>, qemu-devel@nongnu.org
Cc: Laurent Vivier <laurent@vivier.eu>
Subject: Re: [PATCH 1/2] disas/m68k: Replace sprintf() by snprintf()
Date: Thu, 11 Apr 2024 14:57:58 -0700 [thread overview]
Message-ID: <57bc4ad7-ade2-4ef1-80f5-8b5c6f6c85bf@linaro.org> (raw)
In-Reply-To: <20240411213933.36548-2-philmd@linaro.org>
On 4/11/24 14:39, Philippe Mathieu-Daudé wrote:
> @@ -974,7 +974,7 @@ print_base (int regno, bfd_vma disp, disassemble_info *info)
> else
> (*info->fprintf_func) (info->stream, "%s@(", reg_names[regno]);
>
> - sprintf_vma (buf, disp);
> + snprintf(buf, sizeof(buf), "%0" PRIx64, disp);
> (*info->fprintf_func) (info->stream, "%s", buf);
> }
> }
> @@ -1069,7 +1069,7 @@ print_indexed (int basereg,
> (*info->fprintf_func) (info->stream, ",%s", buf);
> buf[0] = '\0';
> }
> - sprintf_vma (vmabuf, outer_disp);
> + snprintf(vmabuf, sizeof(vmabuf), "%0" PRIx64, outer_disp);
> (*info->fprintf_func) (info->stream, ")@(%s", vmabuf);
> if (buf[0] != '\0')
> (*info->fprintf_func) (info->stream, ",%s", buf);
In both cases, there's no need for the sprintf at all.
Fold everything into the adjacent fprintf.
r~
next prev parent reply other threads:[~2024-04-11 21:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-04-11 21:39 [PATCH 0/2] m68k: Remove sprintf() calls due to macOS deprecation Philippe Mathieu-Daudé
2024-04-11 21:39 ` [PATCH 1/2] disas/m68k: Replace sprintf() by snprintf() Philippe Mathieu-Daudé
2024-04-11 21:57 ` Richard Henderson [this message]
2024-04-11 21:39 ` [PATCH 2/2] target/m68k: Remove sprintf() calls Philippe Mathieu-Daudé
2024-04-11 21:58 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=57bc4ad7-ade2-4ef1-80f5-8b5c6f6c85bf@linaro.org \
--to=richard.henderson@linaro.org \
--cc=laurent@vivier.eu \
--cc=philmd@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).