| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
…rray` In the latter we make use of the pointers provided to use by ruby and its string types, so we do not allocate memory for the strings themselves. This is different from what libgit2 expects and so we end up using `xfree(x.strings)` which also looks wrong as we're not looking at the actual strings. Provide this dispose function to make it clearer that we are doing the right thing and which also zeroes out the values in the `git_strarray`.
The only difference here is we don't want to accept a single value so we check the type before calling the function.
This makes it clear that we are freeing correctly in the places where we re-used the strings from ruby.
| Back | FazBrowse Home | New Git URL |
When we use rugged_rb_ary_to_strarray, we make use of StringValueCStr to get a pointer to the ruby memory, which we then use to fill in the char** that we did allocate to keep the pointers in.
We cannot use git_strarray_dipose as that assumes we own all the memory and it will try to free ruby's memory. We instead have been using xfree(x.strings) which is correct but looks like it isn't, because we're not touching the actual pointers to the string. We also don't zero out the values though in practice that shouldn't matter where we use it.
Here we add rugged_strarray_dispose which makes it clear that we are using the right thing paired with ruged_rb_ary_to_strarray.