aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/main.c
diff options
context:
space:
mode:
authorThiago de Arruda <tpadilha84@gmail.com>2015-04-12 11:37:22 -0300
committerThiago de Arruda <tpadilha84@gmail.com>2015-04-13 08:22:44 -0300
commit34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b (patch)
tree3342c6d4a1cc54bbadb6018725410117885b3517 /src/nvim/main.c
parentba10e311bddab18e38b1b706e232f804c2da9174 (diff)
downloadrneovim-34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b.tar.gz
rneovim-34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b.tar.bz2
rneovim-34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b.zip
memory: Add `free` wrapper and refactor project to use it
We already use wrappers for allocation, the new `xfree` function is the equivalent for deallocation and provides a way to fully replace the malloc implementation used by Neovim.
Diffstat (limited to 'src/nvim/main.c')
-rw-r--r--src/nvim/main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index a03fd2e8a9..4753dc31c3 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -644,7 +644,7 @@ main_loop (
// duplicates.
p = keep_msg;
msg_attr(p, keep_msg_attr);
- free(p);
+ xfree(p);
}
if (need_fileinfo) { /* show file info after redraw */
fileinfo(FALSE, TRUE, FALSE);
@@ -840,7 +840,7 @@ static void init_locale(void)
bindtextdomain(VIMPACKAGE, (char *)NameBuff);
}
if (mustfree)
- free(p);
+ xfree(p);
textdomain(VIMPACKAGE);
}
TIME_MSG("locale set");
@@ -1285,7 +1285,7 @@ scripterror:
char_u *r;
r = concat_fnames(p, path_tail(alist_name(&GARGLIST[0])), TRUE);
- free(p);
+ xfree(p);
p = r;
}
@@ -1322,7 +1322,7 @@ scripterror:
p = xmalloc(STRLEN(parmp->commands[0]) + 3);
sprintf((char *)p, ":%s\r", parmp->commands[0]);
set_vim_var_string(VV_SWAPCOMMAND, p, -1);
- free(p);
+ xfree(p);
}
TIME_MSG("parsing arguments");
}
@@ -1753,7 +1753,7 @@ static void exe_commands(mparm_T *parmp)
for (i = 0; i < parmp->n_commands; ++i) {
do_cmdline_cmd(parmp->commands[i]);
if (parmp->cmds_tofree[i])
- free(parmp->commands[i]);
+ xfree(parmp->commands[i]);
}
sourcing_name = NULL;
current_SID = 0;