diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-04-12 11:37:22 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-04-13 08:22:44 -0300 |
commit | 34c48aaf123ffd8aec31b79f0b4d16d9a63fe59b (patch) | |
tree | 3342c6d4a1cc54bbadb6018725410117885b3517 /src/nvim/memory.c | |
parent | ba10e311bddab18e38b1b706e232f804c2da9174 (diff) | |
download | rneovim-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/memory.c')
-rw-r--r-- | src/nvim/memory.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/nvim/memory.c b/src/nvim/memory.c index 2223b65a93..35409aef49 100644 --- a/src/nvim/memory.c +++ b/src/nvim/memory.c @@ -92,6 +92,12 @@ void *xmalloc(size_t size) return ret; } +/// free wrapper that returns delegates to the backing memory manager +void xfree(void *ptr) +{ + free(ptr); +} + /// calloc() wrapper /// /// @see {xmalloc} @@ -541,8 +547,8 @@ void free_all_mem(void) clear_sb_text(); /* free any scrollback text */ /* Free some global vars. */ - free(last_cmdline); - free(new_last_cmdline); + xfree(last_cmdline); + xfree(new_last_cmdline); set_keep_msg(NULL, 0); /* Clear cmdline history. */ |