feat(runtime-c-api) Move wasmer_validate into the module module.

This commit is contained in:
Ivan Enderlin 2019-03-29 14:59:02 +01:00
parent 55c010688c
commit 4239975240
2 changed files with 15 additions and 15 deletions

View File

@ -128,21 +128,6 @@ pub struct wasmer_byte_array {
bytes_len: uint32_t,
}
/// Returns true for valid wasm bytes and false for invalid bytes
#[allow(clippy::cast_ptr_alignment)]
#[no_mangle]
pub unsafe extern "C" fn wasmer_validate(
wasm_bytes: *const uint8_t,
wasm_bytes_len: uint32_t,
) -> bool {
if wasm_bytes.is_null() {
return false;
}
let bytes: &[u8] = slice::from_raw_parts(wasm_bytes, wasm_bytes_len as usize);
wasmer_runtime_core::validate(bytes)
}
/// Creates a new Table for the given descriptor and initializes the given
/// pointer to pointer to a pointer to the new Table.
///

View File

@ -42,6 +42,21 @@ pub unsafe extern "C" fn wasmer_compile(
wasmer_result_t::WASMER_OK
}
/// Returns true for valid wasm bytes and false for invalid bytes
#[allow(clippy::cast_ptr_alignment)]
#[no_mangle]
pub unsafe extern "C" fn wasmer_validate(
wasm_bytes: *const uint8_t,
wasm_bytes_len: uint32_t,
) -> bool {
if wasm_bytes.is_null() {
return false;
}
let bytes: &[u8] = slice::from_raw_parts(wasm_bytes, wasm_bytes_len as usize);
wasmer_runtime_core::validate(bytes)
}
/// Creates a new Instance from the given module and imports.
///
/// Returns `wasmer_result_t::WASMER_OK` upon success.