summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2019-10-18 15:33:13 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2019-10-18 15:35:15 -0700
commitf9744a5f09fe3d786de8dfb264598bf4d77ece8c (patch)
treeb3f9190cbbb85243f7eb88c5cf632ce0c0a09853
parentf60ed6e3e4f580d9d967fac28e345aca911ca04f (diff)
downloademacs-f9744a5f09fe3d786de8dfb264598bf4d77ece8c.tar.gz
emacs-f9744a5f09fe3d786de8dfb264598bf4d77ece8c.tar.bz2
emacs-f9744a5f09fe3d786de8dfb264598bf4d77ece8c.zip
Pacify x86 GCC 9 in tab bar code
* src/xdisp.c (tty_get_tab_bar_item): Simplify a bit. This pacifies --enable-gcc-warnings with x86 GCC 9.2.1 20190827 (Red Hat 9.2.1-1) when combined with -fsanitize=undefined.
-rw-r--r--src/xdisp.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/src/xdisp.c b/src/xdisp.c
index 457fa4343f1..0d8f9a1edd5 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -13419,26 +13419,22 @@ static Lisp_Object
tty_get_tab_bar_item (struct frame *f, int x, int *idx, ptrdiff_t *end)
{
ptrdiff_t clen = 0;
- Lisp_Object caption;
- int i, j;
- for (i = 0, j = 0; i < f->n_tab_bar_items; i++, j += TAB_BAR_ITEM_NSLOTS)
+ for (int i = 0; i < f->n_tab_bar_items; i++)
{
- caption = AREF (f->tab_bar_items, j + TAB_BAR_ITEM_CAPTION);
+ Lisp_Object caption = AREF (f->tab_bar_items, (i * TAB_BAR_ITEM_NSLOTS
+ + TAB_BAR_ITEM_CAPTION));
if (NILP (caption))
return Qnil;
clen += SCHARS (caption);
if (x < clen)
- break;
- }
- if (i < f->n_tab_bar_items)
- {
- *idx = i;
- *end = clen;
- return caption;
+ {
+ *idx = i;
+ *end = clen;
+ return caption;
+ }
}
- else
- return Qnil;
+ return Qnil;
}
/* Handle a mouse click at X/Y on the tab bar of TTY frame F. If the