Add AWA_OPAQUE macro to Awa static API #68
Merged
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.
The opaque data type is a little different from all the others
being that it is variable length (and doesn't provide another
mechanism to determine it's length, i.e NULL terminated)
This means we need to store a provide a pointer to data, as
well as a pointer to store the length to the
AwaStaticClient_RegisterResourceWithPointer() function.
Now we could simply pass in a pointer to a AwaOpaque data type,
but this is setup for dynamic memory allocation, which goes
against the whole point of the WithPointer() function.
So, to allow variable length opaque data types to be statically
allocated, I have added the AWA_OPAQUE macro.
This macro can be used in place of a variable declaration.
for example:
I have also added the internal data type AwaStaticOpaque which allows
the core to access the elements like so:
Signed-off-by: Chris Dewbery [email protected]