mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
alloc: xmalloc and xrealloc can't return null
With this annotation/function attribute, we can inform gcc that these functions never return null, which can save a lot of redundant null checks.
This commit is contained in:
parent
22e17e25f1
commit
7b14caf604
@ -29,9 +29,10 @@ char_u *alloc_clear(unsigned size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1);
|
||||
char_u *alloc_check(unsigned size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1);
|
||||
char_u *lalloc_clear(long_u size, int message) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1);
|
||||
void try_to_free_memory();
|
||||
void *xmalloc(size_t size) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1);
|
||||
void *xmalloc(size_t size)
|
||||
FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1) FUNC_ATTR_NONNULL_RET;
|
||||
void *xrealloc(void *ptr, size_t size)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALLOC_SIZE(2);
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_ALLOC_SIZE(2) FUNC_ATTR_NONNULL_RET;
|
||||
char_u *lalloc(long_u size, int message) FUNC_ATTR_MALLOC FUNC_ATTR_ALLOC_SIZE(1);
|
||||
void do_outofmem_msg(long_u size);
|
||||
void free_all_mem(void);
|
||||
|
Loading…
Reference in New Issue
Block a user