From b273481f2a840a05e4039655be99528e1fa9388c Mon Sep 17 00:00:00 2001 From: Ed Maste Date: Fri, 22 May 2026 14:08:58 -0400 Subject: [PATCH] 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 --- 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); }