Change translate_module to use a slice rather than a borrowed Vec.

This makes it more convenient to call from a cargo-fuzz fuzzer.
This commit is contained in:
Dan Gohman
2017-08-29 06:21:28 -07:00
parent 5303e7708b
commit b2fcb1ad17

View File

@@ -58,10 +58,10 @@ impl ImportMappings {
/// [`Function`](../cretonne/ir/function/struct.Function.html).
/// Returns the functions and also the mappings for imported functions and signature between the
/// indexes in the wasm module and the indexes inside each functions.
pub fn translate_module(data: &Vec<u8>,
pub fn translate_module(data: &[u8],
runtime: &mut WasmRuntime)
-> Result<TranslationResult, String> {
let mut parser = Parser::new(data.as_slice());
let mut parser = Parser::new(data);
match *parser.read() {
ParserState::BeginWasm { .. } => {}
ParserState::Error(BinaryReaderError { message, offset }) => {