mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge #6528 from ZyX-I/revise-malloc-attr
Revise places where FUNC_ATTR_MALLOC is present Closes #6521
This commit is contained in:
commit
5c805f4566
@ -136,7 +136,7 @@ void tv_list_watch_fix(list_T *const l, const listitem_T *const item)
|
||||
///
|
||||
/// @return [allocated] new list.
|
||||
list_T *tv_list_alloc(void)
|
||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
list_T *const list = xcalloc(1, sizeof(list_T));
|
||||
|
||||
@ -1011,7 +1011,6 @@ void tv_dict_item_free(dictitem_T *const item)
|
||||
/// @return [allocated] new dictionary item.
|
||||
static dictitem_T *tv_dict_item_copy(dictitem_T *const di)
|
||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
FUNC_ATTR_MALLOC
|
||||
{
|
||||
dictitem_T *const new_di = tv_dict_item_alloc((const char *)di->di_key);
|
||||
tv_copy(&di->di_tv, &new_di->di_tv);
|
||||
@ -1040,7 +1039,7 @@ void tv_dict_item_remove(dict_T *const dict, dictitem_T *const item)
|
||||
///
|
||||
/// @return [allocated] new dictionary.
|
||||
dict_T *tv_dict_alloc(void)
|
||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
dict_T *const d = xmalloc(sizeof(dict_T));
|
||||
|
||||
@ -1577,7 +1576,7 @@ void tv_dict_set_keys_readonly(dict_T *const dict)
|
||||
///
|
||||
/// @return [allocated] pointer to the created list.
|
||||
list_T *tv_list_alloc_ret(typval_T *const ret_tv)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_MALLOC
|
||||
FUNC_ATTR_NONNULL_ALL
|
||||
{
|
||||
list_T *const l = tv_list_alloc();
|
||||
ret_tv->vval.v_list = l;
|
||||
|
@ -802,7 +802,6 @@ static bool is_append_register(int regname)
|
||||
/// Returns a copy of contents in register `name`
|
||||
/// for use in do_put. Should be freed by caller.
|
||||
yankreg_T *copy_register(int name)
|
||||
FUNC_ATTR_MALLOC
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
yankreg_T *reg = get_yank_register(name, YREG_PASTE);
|
||||
|
@ -6974,7 +6974,7 @@ bool signcolumn_on(win_T *wp)
|
||||
|
||||
/// Get window or buffer local options
|
||||
dict_T *get_winbuf_options(const int bufopt)
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT FUNC_ATTR_MALLOC
|
||||
FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
dict_T *const d = tv_dict_alloc();
|
||||
|
||||
|
@ -100,7 +100,7 @@ int file_open(FileDescriptor *const ret_fp, const char *const fname,
|
||||
/// @return [allocated] Opened file or NULL in case of error.
|
||||
FileDescriptor *file_open_new(int *const error, const char *const fname,
|
||||
const int flags, const int mode)
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_MALLOC FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
FUNC_ATTR_NONNULL_ALL FUNC_ATTR_WARN_UNUSED_RESULT
|
||||
{
|
||||
FileDescriptor *const fp = xmalloc(sizeof(*fp));
|
||||
if ((*error = file_open(fp, fname, flags, mode)) != 0) {
|
||||
|
@ -47,7 +47,7 @@ typedef struct {
|
||||
/// @param extra_args Extra arguments to the shell, or NULL.
|
||||
/// @return Newly allocated argument vector. Must be freed with shell_free_argv.
|
||||
char **shell_build_argv(const char *cmd, const char *extra_args)
|
||||
FUNC_ATTR_NONNULL_RET FUNC_ATTR_MALLOC
|
||||
FUNC_ATTR_NONNULL_RET
|
||||
{
|
||||
size_t argc = tokenize(p_sh, NULL) + (cmd ? tokenize(p_shcf, NULL) : 0);
|
||||
char **rv = xmalloc((argc + 4) * sizeof(*rv));
|
||||
|
Loading…
Reference in New Issue
Block a user