Have declare_table_elements consume its elements argument.

The producer is already allocating a new Vec, so no need to require the
consumer to allocate one too.
This commit is contained in:
Dan Gohman
2017-10-13 12:40:15 -07:00
parent bd94a3b202
commit c808447468
3 changed files with 3 additions and 3 deletions

View File

@@ -254,7 +254,7 @@ impl<'data> ModuleEnvironment<'data> for DummyEnvironment {
_table_index: TableIndex,
_base: Option<GlobalIndex>,
_offset: usize,
_elements: &[FunctionIndex],
_elements: Vec<FunctionIndex>,
) {
// We do nothing
}

View File

@@ -190,7 +190,7 @@ pub trait ModuleEnvironment<'data> {
table_index: TableIndex,
base: Option<GlobalIndex>,
offset: usize,
elements: &[FunctionIndex],
elements: Vec<FunctionIndex>,
);
/// Declares a memory to the environment
fn declare_memory(&mut self, memory: Memory);

View File

@@ -364,7 +364,7 @@ pub fn parse_elements_section(
ParserState::ElementSectionEntryBody(ref elements) => {
let elems: Vec<FunctionIndex> =
elements.iter().map(|&x| x as FunctionIndex).collect();
environ.declare_table_elements(table_index, base, offset, &elems)
environ.declare_table_elements(table_index, base, offset, elems)
}
ref s => return Err(SectionParsingError::WrongSectionContent(format!("{:?}", s))),
};