mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Stylo: replace uses of mem::uninitialized with MaybeUninit
MozReview-Commit-ID: KGhYL6DJRaR
This commit is contained in:
parent
00b3fb49c4
commit
17ec774a49
9 changed files with 60 additions and 68 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue