mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +00:00
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.
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
/// Clear an allocated growing array.
|
||||
void ga_clear(garray_T *gap)
|
||||
{
|
||||
free(gap->ga_data);
|
||||
xfree(gap->ga_data);
|
||||
|
||||
// Initialize growing array without resetting itemsize or growsize
|
||||
gap->ga_data = NULL;
|
||||
@@ -114,7 +114,7 @@ void ga_remove_duplicate_strings(garray_T *gap)
|
||||
// loop over the growing array in reverse
|
||||
for (int i = gap->ga_len - 1; i > 0; i--) {
|
||||
if (fnamecmp(fnames[i - 1], fnames[i]) == 0) {
|
||||
free(fnames[i]);
|
||||
xfree(fnames[i]);
|
||||
|
||||
// close the gap (move all strings one slot lower)
|
||||
for (int j = i + 1; j < gap->ga_len; j++) {
|
||||
|
Reference in New Issue
Block a user