Remove null pointer checks generally, re-add them in Emscripten

This commit is contained in:
Mark McCaskey
2019-09-20 11:59:20 -07:00
parent 0790ebff0c
commit 882a77ccf9
9 changed files with 136 additions and 30 deletions

View File

@@ -12,14 +12,14 @@ pub use self::windows::*;
use libc::c_char;
use crate::{allocate_on_stack, EmscriptenData};
use crate::{
allocate_on_stack,
ptr::{Array, WasmPtr},
EmscriptenData,
};
use std::os::raw::c_int;
use wasmer_runtime_core::{
memory::ptr::{Array, WasmPtr},
types::ValueType,
vm::Ctx,
};
use wasmer_runtime_core::{types::ValueType, vm::Ctx};
pub fn call_malloc(ctx: &mut Ctx, size: u32) -> u32 {
get_emscripten_data(ctx)

View File

@@ -9,11 +9,9 @@ use std::mem;
use std::os::raw::c_char;
use crate::env::{call_malloc, call_malloc_with_cast, EmAddrInfo, EmSockAddr};
use crate::ptr::{Array, WasmPtr};
use crate::utils::{copy_cstr_into_wasm, copy_terminated_array_of_cstrs};
use wasmer_runtime_core::{
memory::ptr::{Array, WasmPtr},
vm::Ctx,
};
use wasmer_runtime_core::vm::Ctx;
// #[no_mangle]
/// emscripten: _getenv // (name: *const char) -> *const c_char;

View File

@@ -6,8 +6,9 @@ use std::mem;
use std::os::raw::c_char;
use crate::env::{call_malloc, EmAddrInfo};
use crate::ptr::WasmPtr;
use crate::utils::{copy_cstr_into_wasm, read_string_from_wasm};
use wasmer_runtime_core::{memory::ptr::WasmPtr, vm::Ctx};
use wasmer_runtime_core::vm::Ctx;
extern "C" {
#[link_name = "_putenv"]