Skip to content

Commit

Permalink
Convert mem::zeroed() / 0 to MaybeUninit::uninit() (#798)
Browse files Browse the repository at this point in the history
* Convert `mem::zeroed()` / `0` to `MaybeUninit::uninit()`

As noted in #792 changes like this might help us more strictly identify
and validate that the argument in question is only relevant as an output
argument (i.e. structs with `sType` are read by the function call, even
if the caller strictly expects return values there, so that it can fill
in multiple structures in a `pNext` chain, and must hence be `Default`-
initialized).

* Use uninit `Vec`s with late `set_len()` call instead of zero-initialization

* Use `uninit()` instead of `-1` for file descriptors

* Introduce `set_vec_len_on_success()` helper for `Vec::with_capacity()`
  • Loading branch information
MarijnS95 authored Dec 1, 2023
1 parent 02c7a83 commit 4e99de1
Show file tree
Hide file tree
Showing 53 changed files with 380 additions and 348 deletions.
1 change: 0 additions & 1 deletion ash-examples/src/bin/texture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -768,7 +768,6 @@ fn main() {
device.cmd_end_render_pass(draw_command_buffer);
},
);
//let mut present_info_err = mem::zeroed();
let present_info = vk::PresentInfoKHR {
wait_semaphore_count: 1,
p_wait_semaphores: &base.rendering_complete_semaphore,
Expand Down
1 change: 0 additions & 1 deletion ash-examples/src/bin/triangle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ fn main() {
device.cmd_end_render_pass(draw_command_buffer);
},
);
//let mut present_info_err = mem::zeroed();
let wait_semaphors = [base.rendering_complete_semaphore];
let swapchains = [base.swapchain];
let image_indices = [present_index];
Expand Down
Loading

0 comments on commit 4e99de1

Please sign in to comment.