That `(x)mempcpy(e, event.data, min(EVENT_MAXLEN, length)) = NUL;` line, though compact, is pretty opaque and should probably be abstracted behind a function. I've been meaning to import `xmempcpy` in the codebase as well, but hadn't found a use yet.