diff --git a/CHANGELOG.md b/CHANGELOG.md index 43765252370..ecc329667c9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## **[Unreleased]** +- [#1335](https://github.com/wasmerio/wasmer/pull/1335) Change mutability of `memory` to `const` in `wasmer_memory_data_length` in the C API - [#1329](https://github.com/wasmerio/wasmer/pull/1329) New numbers and strings instructions for WIT - [#1332](https://github.com/wasmerio/wasmer/pull/1332) Add option to `CompilerConfig` to force compiler IR verification off even when `debug_assertions` are enabled. This can be used to make debug builds faster, which may be important if you're creating a library that wraps Wasmer and depend on the speed of debug builds. - [#1320](https://github.com/wasmerio/wasmer/pull/1320) Change `custom_sections` field in `ModuleInfo` to be more standards compliant by allowing multiple custom sections with the same name. To get the old behavior with the new API, you can add `.last().unwrap()` to accesses. For example, `module_info.custom_sections["custom_section_name"].last().unwrap()`. diff --git a/lib/runtime-c-api/src/memory.rs b/lib/runtime-c-api/src/memory.rs index 6d326876847..40f5718bce7 100644 --- a/lib/runtime-c-api/src/memory.rs +++ b/lib/runtime-c-api/src/memory.rs @@ -198,7 +198,7 @@ pub extern "C" fn wasmer_memory_data(memory: *const wasmer_memory_t) -> *mut u8 /// ``` #[allow(clippy::cast_ptr_alignment)] #[no_mangle] -pub extern "C" fn wasmer_memory_data_length(memory: *mut wasmer_memory_t) -> u32 { +pub extern "C" fn wasmer_memory_data_length(memory: *const wasmer_memory_t) -> u32 { if memory.is_null() { return 0; } diff --git a/lib/runtime-c-api/wasmer.h b/lib/runtime-c-api/wasmer.h index 7a872f65c8f..1e7d9296d74 100644 --- a/lib/runtime-c-api/wasmer.h +++ b/lib/runtime-c-api/wasmer.h @@ -1171,7 +1171,7 @@ uint8_t *wasmer_memory_data(const wasmer_memory_t *memory); * uint32_t memory_data_length = wasmer_memory_data_length(memory); * ``` */ -uint32_t wasmer_memory_data_length(wasmer_memory_t *memory); +uint32_t wasmer_memory_data_length(const wasmer_memory_t *memory); /** * Frees memory for the given `wasmer_memory_t`. diff --git a/lib/runtime-c-api/wasmer.hh b/lib/runtime-c-api/wasmer.hh index 6bd66d40bfa..0bbf819ccca 100644 --- a/lib/runtime-c-api/wasmer.hh +++ b/lib/runtime-c-api/wasmer.hh @@ -964,7 +964,7 @@ uint8_t *wasmer_memory_data(const wasmer_memory_t *memory); /// ```c /// uint32_t memory_data_length = wasmer_memory_data_length(memory); /// ``` -uint32_t wasmer_memory_data_length(wasmer_memory_t *memory); +uint32_t wasmer_memory_data_length(const wasmer_memory_t *memory); /// Frees memory for the given `wasmer_memory_t`. ///