Commit Graph

4 Commits

Author SHA1 Message Date
Thiago de Arruda
51ee26fe68 Implement generic map on top of khash
Implement a generic string->pointer associative array on top of the khash macro
library, providing a nice API for simple hash table requirements. (khash gives
lot of control with a not-so-friendly API, which is unnecessary on most cases)
2014-05-12 19:28:25 -03:00
Felipe Oliveira Carvalho
967fb1aca6 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.
2014-04-07 00:22:01 -03:00
Felipe Oliveira Carvalho
fac85c1724 Implement xcalloc and use it in klist.h (use xrealloc as well)
Bonus: implement lalloc_clear and alloc_clear using xcalloc
2014-04-07 00:22:01 -03:00
Felipe Oliveira Carvalho
fa02ada732 Add klib.h to src/lib
As decided on #434 [1].

[1] https://github.com/neovim/neovim/issues/434#issuecomment-39111868
[2] https://github.com/attractivechaos/klib
2014-04-07 00:22:01 -03:00