EVENT_INIT via a compound literal

This pacifies GCC 16.1.1 x86-64 -Warray-bounds when compiling with
-fsanitize=address.  It’s also cleaner on more-typical platforms.
* src/termhooks.h (EVENT_INIT): Define via a compound literal
rather than via a memset plus an assignment.  This evaluates the
argument lvalue only once, and is more likely to catch type errors.
This commit is contained in:
Paul Eggert 2026-05-23 18:48:45 -07:00
parent 7bfde4d50b
commit e7a333f18e

View file

@ -411,8 +411,7 @@ struct input_event
Lisp_Object device;
};
#define EVENT_INIT(event) (memset (&(event), 0, sizeof (struct input_event)), \
(event).device = Qt)
#define EVENT_INIT(event) ((event) = (struct input_event) {.device = Qt})
/* Bits in the modifiers member of the input_event structure.
Note that reorder_modifiers assumes that the bits are in canonical