Remove encode_terminal_code UNINITs

* src/term.c (encode_terminal_code): Clarify by removing a couple
of UNINITs and testing the local variable ‘cmp’ instead of
retesting src->u.cmp.automatic.  This pacifies gcc 11.2.1
-Wanalyzer-null-dereference.
This commit is contained in:
Paul Eggert 2021-10-03 17:52:04 -07:00
parent 2a00634880
commit 7e871dcd27

View file

@ -549,13 +549,14 @@ encode_terminal_code (struct glyph *src, int src_len,
{
if (src->type == COMPOSITE_GLYPH)
{
struct composition *cmp UNINIT;
Lisp_Object gstring UNINIT;
struct composition *cmp;
Lisp_Object gstring;
int i;
nbytes = buf - encode_terminal_src;
if (src->u.cmp.automatic)
{
cmp = NULL;
gstring = composition_gstring_from_id (src->u.cmp.id);
required = src->slice.cmp.to - src->slice.cmp.from + 1;
}
@ -575,7 +576,7 @@ encode_terminal_code (struct glyph *src, int src_len,
buf = encode_terminal_src + nbytes;
}
if (src->u.cmp.automatic)
if (!cmp)
for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++)
{
Lisp_Object g = LGSTRING_GLYPH (gstring, i);