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/misc1.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/misc1.c')
-rw-r--r-- | src/nvim/misc1.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/nvim/misc1.c b/src/nvim/misc1.c index e58ec71e77..d8b84293c3 100644 --- a/src/nvim/misc1.c +++ b/src/nvim/misc1.c @@ -929,16 +929,16 @@ open_line ( curwin->w_cursor.col = 0; curwin->w_cursor.coladd = 0; ins_bytes(p_extra); /* will call changed_bytes() */ - free(p_extra); + xfree(p_extra); next_line = NULL; } retval = TRUE; /* success! */ theend: curbuf->b_p_pi = saved_pi; - free(saved_line); - free(next_line); - free(allocated); + xfree(saved_line); + xfree(next_line); + xfree(allocated); return retval; } @@ -2432,7 +2432,7 @@ int get_keystroke(void) #endif break; } - free(buf); + xfree(buf); mapped_ctrl_c = save_mapped_ctrl_c; return n; @@ -2784,7 +2784,7 @@ get_cmd_output ( call_shell(command, kShellOptDoOut | kShellOptExpand | flags, NULL); --no_check_timestamps; - free(command); + xfree(command); /* * read the names from the file into memory @@ -2806,7 +2806,7 @@ get_cmd_output ( os_remove((char *)tempname); if (i != len) { EMSG2(_(e_notread), tempname); - free(buffer); + xfree(buffer); buffer = NULL; } else if (ret_len == NULL) { /* Change NUL into SOH, otherwise the string is truncated. */ @@ -2820,7 +2820,7 @@ get_cmd_output ( } done: - free(tempname); + xfree(tempname); return buffer; } @@ -2833,8 +2833,8 @@ void FreeWild(int count, char_u **files) if (count <= 0 || files == NULL) return; while (count--) - free(files[count]); - free(files); + xfree(files[count]); + xfree(files); } /* |