Fix wasm_runtime_load argument type invalid issue (#1059)

Remove the `const` flag for the first argument `buf` of wasm_runtime_load as
it might be modified by runtime for footprint and performance purpose, and
update the related functions and document.
This commit is contained in:
Wenyong Huang
2022-03-24 10:08:49 +08:00
committed by GitHub
parent 38b07b3614
commit b6e5206e61
8 changed files with 12 additions and 10 deletions

View File

@ -3578,7 +3578,7 @@ check_wasi_abi_compatibility(const WASMModule *module, bool main_module,
#endif
WASMModule *
wasm_loader_load(const uint8 *buf, uint32 size,
wasm_loader_load(uint8 *buf, uint32 size,
#if WASM_ENABLE_MULTI_MODULE != 0
bool main_module,
#endif

View File

@ -24,7 +24,7 @@ extern "C" {
* @return return module loaded, NULL if failed
*/
WASMModule *
wasm_loader_load(const uint8 *buf, uint32 size,
wasm_loader_load(uint8 *buf, uint32 size,
#if WASM_ENABLE_MULTI_MODULE != 0
bool main_module,
#endif

View File

@ -2336,7 +2336,7 @@ load(const uint8 *buf, uint32 size, WASMModule *module, char *error_buf,
}
WASMModule *
wasm_loader_load(const uint8 *buf, uint32 size, char *error_buf,
wasm_loader_load(uint8 *buf, uint32 size, char *error_buf,
uint32 error_buf_size)
{
WASMModule *module = create_module(error_buf, error_buf_size);

View File

@ -45,7 +45,7 @@ set_error_buf_v(char *error_buf, uint32 error_buf_size, const char *format, ...)
}
WASMModule *
wasm_load(const uint8 *buf, uint32 size, char *error_buf, uint32 error_buf_size)
wasm_load(uint8 *buf, uint32 size, char *error_buf, uint32 error_buf_size)
{
return wasm_loader_load(buf, size,
#if WASM_ENABLE_MULTI_MODULE != 0

View File

@ -273,8 +273,7 @@ wasm_get_func_code_end(WASMFunctionInstance *func)
}
WASMModule *
wasm_load(const uint8 *buf, uint32 size, char *error_buf,
uint32 error_buf_size);
wasm_load(uint8 *buf, uint32 size, char *error_buf, uint32 error_buf_size);
WASMModule *
wasm_load_from_sections(WASMSection *section_list, char *error_buf,