mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
feat(runtime-c-api) Move wasmer_validate
into the module
module.
This commit is contained in:
parent
55c010688c
commit
4239975240
@ -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.
|
||||
///
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user