Date: Fri, 24 Jul 2026 15:46:18 +0000 From: Ed Maste <emaste@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: cff985d49b4b - stable/15 - vtfontcvt: Avoid dead store in add_char Message-ID: <6a6388ca.3ae99.423a26e@gitrepo.freebsd.org>
index | next in thread | raw e-mail
The branch stable/15 has been updated by emaste: URL: https://cgit.FreeBSD.org/src/commit/?id=cff985d49b4bc3b9bb33653557ca5956fa070ce4 commit cff985d49b4bc3b9bb33653557ca5956fa070ce4 Author: Ed Maste <emaste@FreeBSD.org> AuthorDate: 2026-05-22 18:08:58 +0000 Commit: Ed Maste <emaste@FreeBSD.org> CommitDate: 2026-07-24 15:45:58 +0000 vtfontcvt: Avoid dead store in add_char The fallback glyph is stored at index 0, and does not need to be inserted into a mapping. Previously there was a dead store of add_glyph's return value for the fallback case, which upset Clang's static analyzer. Now, cast the return value to (void) to make it clear this is intentional. Also change add_glyph's fallback parameter to a c99 bool to make its use more clear. Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D57174 (cherry picked from commit b273481f2a840a05e4039655be99528e1fa9388c) --- usr.bin/vtfontcvt/vtfontcvt.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c index f39076b09be6..29294f589fb5 100644 --- a/usr.bin/vtfontcvt/vtfontcvt.c +++ b/usr.bin/vtfontcvt/vtfontcvt.c @@ -254,7 +254,7 @@ dedup_mapping(unsigned int map_idx) } static struct glyph * -add_glyph(const uint8_t *bytes, unsigned int map_idx, int fallback) +add_glyph(const uint8_t *bytes, unsigned int map_idx, bool fallback) { struct glyph *gl; int hash; @@ -321,13 +321,13 @@ add_char(unsigned curchar, unsigned map_idx, uint8_t *bytes, uint8_t *bytes_r) /* Prevent adding two glyphs for 0xFFFD */ if (curchar == 0xFFFD) { if (map_idx < VFNT_MAP_BOLD) - gl = add_glyph(bytes, 0, 1); + (void)add_glyph(bytes, 0, true); } else if (filter == false || curchar >= 0x20) { - gl = add_glyph(bytes, map_idx, 0); + gl = add_glyph(bytes, map_idx, false); if (add_mapping(gl, curchar, map_idx) != 0) return (1); if (bytes_r != NULL) { - gl = add_glyph(bytes_r, map_idx + 1, 0); + gl = add_glyph(bytes_r, map_idx + 1, false); if (add_mapping(gl, curchar, map_idx + 1) != 0) return (1); }home | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?6a6388ca.3ae99.423a26e>
