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

generator: Wrap _as_c_str() getter for possibly-pointers in Option #860

Merged
merged 1 commit into from
Jan 11, 2024

Conversation

MarijnS95
Copy link
Collaborator

While this function is already marked unsafe to represent cases where an invalid pointer might be dereferenced, it should at least be obvious to the caller that there is a real chance for NULL pointers in these CStr getters, which will now be returned as None. This function won't be used in Debug now as the dereference operation is still unsafe.

The _as_c_str() getters for static arrays is left untouched, as the data is read directly from the known-valid struct here.

ash/src/vk/definitions.rs Outdated Show resolved Hide resolved
While this function is already marked `unsafe` to represent cases where
an invalid pointer might be dereferenced, it should at least be obvious
to the caller that there is a real chance for `NULL` pointers in these
`CStr` getters, which will now be returned as `None`.  This function
won't be used in `Debug` now as the dereference operation is still
`unsafe`.

The `_as_c_str()` getters for static arrays is left untouched, as the
data is read directly from the known-valid struct here.
@MarijnS95 MarijnS95 merged commit 92084df into master Jan 11, 2024
20 checks passed
@MarijnS95 MarijnS95 deleted the c-str-getter-null branch January 11, 2024 23:08
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.

2 participants