diff --git a/lib/runtime-c-api/src/lib.rs b/lib/runtime-c-api/src/lib.rs index e0cad3f86..605e9d7e5 100644 --- a/lib/runtime-c-api/src/lib.rs +++ b/lib/runtime-c-api/src/lib.rs @@ -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. /// diff --git a/lib/runtime-c-api/src/module.rs b/lib/runtime-c-api/src/module.rs index 58585dd25..18f169621 100644 --- a/lib/runtime-c-api/src/module.rs +++ b/lib/runtime-c-api/src/module.rs @@ -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.