Stylo: replace uses of mem::uninitialized with MaybeUninit

MozReview-Commit-ID: KGhYL6DJRaR
This commit is contained in:
Simon Sapin 2019-07-06 18:16:30 +02:00
parent 00b3fb49c4
commit 17ec774a49
9 changed files with 60 additions and 68 deletions

View file

@ -390,15 +390,16 @@ ${helpers.predefined_type(
% endfor
};
let mut system: nsFont = unsafe { mem::uninitialized() };
unsafe {
let mut system = mem::MaybeUninit::<nsFont>::uninit();
let system = unsafe {
bindings::Gecko_nsFont_InitSystem(
&mut system,
system.as_mut_ptr(),
id as i32,
cx.style().get_font().gecko(),
cx.device().document()
)
}
);
&mut *system.as_mut_ptr()
};
let font_weight = longhands::font_weight::computed_value::T::from_gecko_weight(system.weight);
let font_stretch = FontStretch(NonNegative(Percentage(unsafe {
bindings::Gecko_FontStretch_ToFloat(system.stretch)
@ -436,7 +437,7 @@ ${helpers.predefined_type(
system_font: *self,
default_font_type: system.fontlist.mDefaultFontType,
};
unsafe { bindings::Gecko_nsFont_Destroy(&mut system); }
unsafe { bindings::Gecko_nsFont_Destroy(system); }
ret
}