mirror of
https://github.com/neovim/neovim.git
synced 2025-09-30 06:58:35 +00:00
GA_DEEP_FREE_PTR: deep free macro for garrays that store simple pointers
By "simple pointer" I mean a pointer that can be freed with a call to `free` without leaking any member pointer. This macro does exactly what `ga_clear_strings` does.
This commit is contained in:
@@ -37,10 +37,7 @@ void ga_clear(garray_T *gap)
|
||||
/// @param gap
|
||||
void ga_clear_strings(garray_T *gap)
|
||||
{
|
||||
for (int i = 0; i < gap->ga_len; ++i) {
|
||||
free(((char_u **)(gap->ga_data))[i]);
|
||||
}
|
||||
ga_clear(gap);
|
||||
GA_DEEP_CLEAR_PTR(gap);
|
||||
}
|
||||
|
||||
/// Initialize a growing array.
|
||||
|
Reference in New Issue
Block a user