Fix mem::uninitialized depricated since 1.38
Fix for `https://github.com/CraneStation/cranelift/issues/826`. This fix will require 1.36 minimal version for all Cranelift. Right? Update cranelift-simplejit/src/memory.rs Co-Authored-By: bjorn3 <bjorn3@users.noreply.github.com> Update memory.rs
This commit is contained in:
committed by
Benjamin Bouvier
parent
f431465802
commit
5672cd651c
@@ -28,10 +28,10 @@ impl PtrLen {
|
|||||||
/// suitably sized and aligned for memory protection.
|
/// suitably sized and aligned for memory protection.
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
fn with_size(size: usize) -> Result<Self, String> {
|
fn with_size(size: usize) -> Result<Self, String> {
|
||||||
|
let mut ptr = ptr::null_mut();
|
||||||
let page_size = region::page::size();
|
let page_size = region::page::size();
|
||||||
let alloc_size = round_up_to_page_size(size, page_size);
|
let alloc_size = round_up_to_page_size(size, page_size);
|
||||||
unsafe {
|
unsafe {
|
||||||
let mut ptr: *mut libc::c_void = mem::uninitialized();
|
|
||||||
let err = libc::posix_memalign(&mut ptr, page_size, alloc_size);
|
let err = libc::posix_memalign(&mut ptr, page_size, alloc_size);
|
||||||
if err == 0 {
|
if err == 0 {
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
|
|||||||
Reference in New Issue
Block a user