neovim/neovim — pull request #476 by philix (2014-04-06 03:57:56+00:00)
Title: [RFC] Reimplement the event queue in event.c using klist.h 

- Add a new macro to klist.h: kl_empty()

The whole point of abstract data structures is to avoid reimplementing
common actions. The emptiness test seems to be such an action.

- Add a new function attribute to func_attr.h: FUNC_ATTR_UNUSED

Some of the many functions created by the macros in klist.h may end up not
being used. Unused functions cause compilation errors as we compile with
-Werror. To mark those functions as possibly unused we can use the
FUNC_ATTR_UNUSED now.

- Pass `Event` by value

`Event` is such a small struct that I don't think we should allocate heap space
and pass it by reference. Let's use the stack and memory cache in our favor
passing it by value.

- Turn Event into a tagged union

If we ever need arbitrary data or more than very few bytes on `Events` we just
have to add a `void *` field in the `data` union.