Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: Have ArrayBuffer::data return Option<NonNull<c_void>> #1131

Merged
merged 1 commit into from
Nov 24, 2022

Conversation

andreubotella
Copy link
Contributor

The pointer returned by ArrayBuffer::data might be null if the backing store has zero length, but the return type *mut c_void does not force the user to consider this case. This change makes the return type Option<NonNull<c_void>>, which is semantically equivalent, but which forces users of the API to handle the None case.

This PR is the ArrayBuffer counterpart to #817.

This is a breaking API change.

The pointer returned by `ArrayBuffer::data` might be null if the
backing store has zero length, but the return type `*mut c_void` does
not force the user to consider this case. This change makes the return
type `Option<NonNull<c_void>>`, which is semantically equivalent, but
which forces users of the API to handle the `None` case.

This PR is the `ArrayBuffer` counterpart to denoland#817.

This is a breaking API change.
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@bartlomieju bartlomieju merged commit d718370 into denoland:main Nov 24, 2022
@andreubotella andreubotella deleted the arraybuffer-data-nonnull branch November 24, 2022 14:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants