diff options
Diffstat (limited to 'src/wasm-vector.h')
-rw-r--r-- | src/wasm-vector.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/wasm-vector.h b/src/wasm-vector.h index 1f4a06e0..c210b4cb 100644 --- a/src/wasm-vector.h +++ b/src/wasm-vector.h @@ -35,6 +35,8 @@ * * void wasm_destroy_widget_vector(WasmAllocator*, WasmWidgetVector* vec); * WasmWidget* wasm_append_widget(WasmAllocator*, WasmWidgetVector* vec); + * WasmResult wasm_resize_widget_vector(WasmAllocator*, WasmWidgetVector* vec, + * size_t size); * WasmResult wasm_reserve_widgets(WasmAllocator*, WasmWidgetVector* vec, * size_t desired); * WasmResult wasm_append_widget_value(WasmAllocator*, WasmWidgetVector* vec, @@ -53,6 +55,9 @@ WASM_EXTERN_C_BEGIN \ static WASM_INLINE void wasm_destroy_##name##_vector( \ struct WasmAllocator* allocator, type##Vector* vec) WASM_UNUSED; \ + static WASM_INLINE WasmResult wasm_resize_##name##_vector( \ + struct WasmAllocator* allocator, type##Vector* vec, size_t desired) \ + WASM_UNUSED; \ static WASM_INLINE WasmResult wasm_reserve_##name##s( \ struct WasmAllocator* allocator, type##Vector* vec, size_t desired) \ WASM_UNUSED; \ @@ -70,6 +75,11 @@ type##Vector* vec) { \ wasm_free(allocator, vec->data); \ } \ + WasmResult wasm_resize_##name##_vector(struct WasmAllocator* allocator, \ + type##Vector* vec, size_t size) { \ + return wasm_resize_vector(allocator, (void**)&vec->data, &vec->size, \ + &vec->capacity, size, sizeof(type)); \ + } \ WasmResult wasm_reserve_##name##s(struct WasmAllocator* allocator, \ type##Vector* vec, size_t desired) { \ return wasm_ensure_capacity(allocator, (void**)&vec->data, &vec->capacity, \ @@ -110,6 +120,13 @@ WasmResult wasm_ensure_capacity(struct WasmAllocator*, size_t desired_size, size_t elt_byte_size) WASM_WARN_UNUSED; +WasmResult wasm_resize_vector(struct WasmAllocator*, + void** data, + size_t* size, + size_t* capacity, + size_t desired_size, + size_t elt_byte_size) WASM_WARN_UNUSED; + void* wasm_append_element(struct WasmAllocator*, void** data, size_t* size, |