Add asdf_free() for buffers the library allocates for the caller - #253
Open
cruzzil wants to merge 1 commit into
Open
Add asdf_free() for buffers the library allocates for the caller#253cruzzil wants to merge 1 commit into
cruzzil wants to merge 1 commit into
Conversation
asdf_write_to_mem, asdf_ndarray_read_all and the asdf_ndarray_read_tile_* family hand the caller a buffer and documented free() as the way to release it, which makes the allocator part of the ABI. Export asdf_free() and point those docs at it instead; it is currently just free(), so existing callers keep working.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #250.
asdf_write_to_mem,asdf_ndarray_read_all,asdf_ndarray_read_tile_ndimandasdf_ndarray_read_tile_2dhand the caller a buffer and documentfree()asthe way to release it, which makes the allocator part of the ABI: it is
undefined behaviour across a DLL boundary where the library and the application
link different C runtimes with separate heaps, and it prevents these functions
from ever allocating differently.
This adds
asdf_free()inasdf/util.h(the one header every other publicheader already includes) and updates the four doc comments, the ndarray/writing
usage docs and the affected tests to use it.
The implementation is just
free(), so this is source-compatible: existingcallers keep working unchanged.