diff options
author | Felipe Oliveira Carvalho <felipekde@gmail.com> | 2014-04-05 16:54:01 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-04-07 00:22:01 -0300 |
commit | fac85c17248ab8c371fb311c1dd4bc1b2a7520cf (patch) | |
tree | 431f4fb73eb063ac4a123c61c043a1d833b00682 /src/memory.h | |
parent | fa02ada73257336641ebb29a9ea0b626c176c011 (diff) | |
download | rneovim-fac85c17248ab8c371fb311c1dd4bc1b2a7520cf.tar.gz rneovim-fac85c17248ab8c371fb311c1dd4bc1b2a7520cf.tar.bz2 rneovim-fac85c17248ab8c371fb311c1dd4bc1b2a7520cf.zip |
Implement xcalloc and use it in klist.h (use xrealloc as well)
Bonus: implement lalloc_clear and alloc_clear using xcalloc
Diffstat (limited to 'src/memory.h')
-rw-r--r-- | src/memory.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/memory.h b/src/memory.h index f5dbe6f453..324670115b 100644 --- a/src/memory.h +++ b/src/memory.h @@ -2,6 +2,8 @@ #define NEOVIM_MEMORY_H #include "func_attr.h" +#include "types.h" +#include "vim.h" char_u *alloc(unsigned size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1); char_u *alloc_clear(unsigned size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1); @@ -19,6 +21,15 @@ char_u *lalloc_clear(long_u size, int message) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_ void *xmalloc(size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1) FUNC_ATTR_NONNULL_RET; +/// calloc() wrapper +/// +/// @see {xmalloc} +/// @param count +/// @param size +/// @return pointer to allocated space. Never NULL +void *xcalloc(size_t count, size_t size) + FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE_PROD(1, 2) FUNC_ATTR_NONNULL_RET; + /// realloc() wrapper /// /// @see {xmalloc} |