Remove uses of mem::uninitialized

This commit is contained in:
Simon Sapin 2019-07-06 23:07:45 +02:00
parent 0677704953
commit b6bd2d7302
4 changed files with 68 additions and 65 deletions

View file

@ -21,7 +21,7 @@ use dom_struct::dom_struct;
use mozangle::shaders::{BuiltInResources, Output, ShaderValidator};
use std::cell::Cell;
use std::os::raw::c_int;
use std::sync::{Once, ONCE_INIT};
use std::sync::Once;
#[derive(Clone, Copy, Debug, JSTraceable, MallocSizeOf, PartialEq)]
pub enum ShaderCompilationStatus {
@ -42,7 +42,7 @@ pub struct WebGLShader {
compilation_status: Cell<ShaderCompilationStatus>,
}
static GLSLANG_INITIALIZATION: Once = ONCE_INIT;
static GLSLANG_INITIALIZATION: Once = Once::new();
impl WebGLShader {
fn new_inherited(context: &WebGLRenderingContext, id: WebGLShaderId, shader_type: u32) -> Self {

View file

@ -106,14 +106,16 @@ use script_traits::SWManagerSenders;
#[cfg(target_os = "linux")]
#[allow(unsafe_code)]
fn perform_platform_specific_initialization() {
use std::mem;
// 4096 is default max on many linux systems
const MAX_FILE_LIMIT: libc::rlim_t = 4096;
// Bump up our number of file descriptors to save us from impending doom caused by an onslaught
// of iframes.
unsafe {
let mut rlim: libc::rlimit = mem::uninitialized();
let mut rlim = libc::rlimit {
rlim_cur: 0,
rlim_max: 0,
};
match libc::getrlimit(libc::RLIMIT_NOFILE, &mut rlim) {
0 => {
if rlim.rlim_cur >= MAX_FILE_LIMIT {