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/terminal.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/terminal.c')
-rw-r--r-- | src/nvim/terminal.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/nvim/terminal.c b/src/nvim/terminal.c index ea0cc88e58..8ee47b2642 100644 --- a/src/nvim/terminal.c +++ b/src/nvim/terminal.c @@ -243,7 +243,7 @@ Terminal *terminal_open(TerminalOptions opts) char *name = get_config_string(rv, var); if (name) { color_val = name_to_color((uint8_t *)name); - free(name); + xfree(name); if (color_val != -1) { rv->colors[i] = color_val; @@ -424,11 +424,11 @@ void terminal_destroy(Terminal *term) term->buf = NULL; pmap_del(ptr_t)(invalidated_terminals, term); for (size_t i = 0 ; i < term->sb_current; i++) { - free(term->sb_buffer[i]); + xfree(term->sb_buffer[i]); } - free(term->sb_buffer); + xfree(term->sb_buffer); vterm_free(term->vt); - free(term); + xfree(term); } void terminal_send(Terminal *term, char *data, size_t size) @@ -603,7 +603,7 @@ static int term_sb_push(int cols, const VTermScreenCell *cells, void *data) // Recycle old row if it's the right size sbrow = term->sb_buffer[term->sb_current - 1]; } else { - free(term->sb_buffer[term->sb_current - 1]); + xfree(term->sb_buffer[term->sb_current - 1]); } memmove(term->sb_buffer + 1, term->sb_buffer, @@ -664,7 +664,7 @@ static int term_sb_pop(int cols, VTermScreenCell *cells, void *data) cells[col].chars[0] = 0; cells[col].width = 1; } - free(sbrow); + xfree(sbrow); pmap_put(ptr_t)(invalidated_terminals, term, NULL); return 1; |