From 8e22c4487f24ac1aff2550aa22de2323a507c11d Mon Sep 17 00:00:00 2001 From: emaste Date: Sat, 15 Jun 2019 09:15:58 +0000 Subject: [PATCH] vtfontcvt: add comments in add_glyph During review for PR 205707. Event: Berlin Devsummit 2019 --- usr.bin/vtfontcvt/vtfontcvt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/vtfontcvt/vtfontcvt.c b/usr.bin/vtfontcvt/vtfontcvt.c index d3c43f424839..d4d17b23e7a9 100644 --- a/usr.bin/vtfontcvt/vtfontcvt.c +++ b/usr.bin/vtfontcvt/vtfontcvt.c @@ -176,6 +176,7 @@ add_glyph(const uint8_t *bytes, unsigned int map_idx, int fallback) glyph_total++; glyph_count[map_idx]++; + /* Return existing glyph if we have an identical one. */ hash = fnv_32_buf(bytes, wbytes * height, FNV1_32_INIT) % FONTCVT_NHASH; SLIST_FOREACH(gl, &glyph_hash[hash], g_hash) { if (memcmp(gl->g_data, bytes, wbytes * height) == 0) { @@ -184,6 +185,7 @@ add_glyph(const uint8_t *bytes, unsigned int map_idx, int fallback) } } + /* Allocate new glyph. */ gl = xmalloc(sizeof *gl); gl->g_data = xmalloc(wbytes * height); memcpy(gl->g_data, bytes, wbytes * height);