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

Rework std::sys::windows::alloc #83065

Merged
merged 5 commits into from
Apr 2, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Apply suggestions from code review
Co-authored-by: David Tolnay <[email protected]>
  • Loading branch information
CDirkx and dtolnay committed Mar 26, 2021
commit b01bf0e9d311332d7942619845281af4b9da54bb
6 changes: 4 additions & 2 deletions library/std/src/sys/windows/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,13 +148,15 @@ unsafe impl GlobalAlloc for System {
#[inline]
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
// SAFETY: pointers returned by `allocate` satisfy the guarantees of `System`
unsafe { allocate(layout, false) }
let zeroed = false;
unsafe { allocate(layout, zeroed) }
}

#[inline]
unsafe fn alloc_zeroed(&self, layout: Layout) -> *mut u8 {
// SAFETY: pointers returned by `allocate` satisfy the guarantees of `System`
unsafe { allocate(layout, true) }
let zeroed = true;
unsafe { allocate(layout, zeroed) }
}

#[inline]
Expand Down