aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2021-10-03 17:52:04 -0700
committerPaul Eggert2021-10-03 17:52:28 -0700
commit7e871dcd27bdb827573ca97e609632e178e76f64 (patch)
tree3e78d1f11f9465f95962f067ae749ec69f1108e0 /src
parent2a00634880adb20071686906ebb183326f2060e0 (diff)
downloademacs-7e871dcd27bdb827573ca97e609632e178e76f64.tar.gz
emacs-7e871dcd27bdb827573ca97e609632e178e76f64.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/term.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/term.c b/src/term.c
index 7d9fe8cee30..0858f816851 100644
--- a/src/term.c
+++ b/src/term.c
@@ -549,13 +549,14 @@ encode_terminal_code (struct glyph *src, int src_len,
549 { 549 {
550 if (src->type == COMPOSITE_GLYPH) 550 if (src->type == COMPOSITE_GLYPH)
551 { 551 {
552 struct composition *cmp UNINIT; 552 struct composition *cmp;
553 Lisp_Object gstring UNINIT; 553 Lisp_Object gstring;
554 int i; 554 int i;
555 555
556 nbytes = buf - encode_terminal_src; 556 nbytes = buf - encode_terminal_src;
557 if (src->u.cmp.automatic) 557 if (src->u.cmp.automatic)
558 { 558 {
559 cmp = NULL;
559 gstring = composition_gstring_from_id (src->u.cmp.id); 560 gstring = composition_gstring_from_id (src->u.cmp.id);
560 required = src->slice.cmp.to - src->slice.cmp.from + 1; 561 required = src->slice.cmp.to - src->slice.cmp.from + 1;
561 } 562 }
@@ -575,7 +576,7 @@ encode_terminal_code (struct glyph *src, int src_len,
575 buf = encode_terminal_src + nbytes; 576 buf = encode_terminal_src + nbytes;
576 } 577 }
577 578
578 if (src->u.cmp.automatic) 579 if (!cmp)
579 for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++) 580 for (i = src->slice.cmp.from; i <= src->slice.cmp.to; i++)
580 { 581 {
581 Lisp_Object g = LGSTRING_GLYPH (gstring, i); 582 Lisp_Object g = LGSTRING_GLYPH (gstring, i);