Skip to content

Commit 1a92564

Browse files
committed
c-api: Fix header declared type
This needs the wasmtime type, not the wasm type 🤦 Signed-off-by: Tyler Rockwood <rockwood@redpanda.com>
1 parent b7c0eae commit 1a92564

1 file changed

Lines changed: 32 additions & 47 deletions

File tree

crates/c-api/include/wasmtime/module.h

Lines changed: 32 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,10 @@ typedef struct wasmtime_module wasmtime_module_t;
4141
* This function does not take ownership of any of its arguments, but the
4242
* returned error and module are owned by the caller.
4343
*/
44-
WASM_API_EXTERN wasmtime_error_t *wasmtime_module_new(
45-
wasm_engine_t *engine,
46-
const uint8_t *wasm,
47-
size_t wasm_len,
48-
wasmtime_module_t **ret
49-
);
44+
WASM_API_EXTERN wasmtime_error_t *wasmtime_module_new(wasm_engine_t *engine,
45+
const uint8_t *wasm,
46+
size_t wasm_len,
47+
wasmtime_module_t **ret);
5048

5149
/**
5250
* \brief Deletes a module.
@@ -62,18 +60,14 @@ WASM_API_EXTERN wasmtime_module_t *wasmtime_module_clone(wasmtime_module_t *m);
6260
/**
6361
* \brief Same as #wasm_module_imports, but for #wasmtime_module_t.
6462
*/
65-
WASM_API_EXTERN void wasmtime_module_imports(
66-
const wasmtime_module_t *module,
67-
wasm_importtype_vec_t *out
68-
);
63+
WASM_API_EXTERN void wasmtime_module_imports(const wasmtime_module_t *module,
64+
wasm_importtype_vec_t *out);
6965

7066
/**
7167
* \brief Same as #wasm_module_exports, but for #wasmtime_module_t.
7268
*/
73-
WASM_API_EXTERN void wasmtime_module_exports(
74-
const wasmtime_module_t *module,
75-
wasm_exporttype_vec_t *out
76-
);
69+
WASM_API_EXTERN void wasmtime_module_exports(const wasmtime_module_t *module,
70+
wasm_exporttype_vec_t *out);
7771

7872
/**
7973
* \brief Validate a WebAssembly binary.
@@ -87,29 +81,25 @@ WASM_API_EXTERN void wasmtime_module_exports(
8781
* If the binary validates then `NULL` is returned, otherwise the error returned
8882
* describes why the binary did not validate.
8983
*/
90-
WASM_API_EXTERN wasmtime_error_t *wasmtime_module_validate(
91-
wasm_engine_t *engine,
92-
const uint8_t *wasm,
93-
size_t wasm_len
94-
);
84+
WASM_API_EXTERN wasmtime_error_t *
85+
wasmtime_module_validate(wasm_engine_t *engine, const uint8_t *wasm,
86+
size_t wasm_len);
9587

9688
/**
9789
* \brief This function serializes compiled module artifacts as blob data.
9890
*
9991
* \param module the module
100-
* \param ret if the conversion is successful, this byte vector is filled in with
101-
* the serialized compiled module.
92+
* \param ret if the conversion is successful, this byte vector is filled in
93+
* with the serialized compiled module.
10294
*
10395
* \return a non-null error if parsing fails, or returns `NULL`. If parsing
10496
* fails then `ret` isn't touched.
10597
*
10698
* This function does not take ownership of `module`, and the caller is
10799
* expected to deallocate the returned #wasmtime_error_t and #wasm_byte_vec_t.
108100
*/
109-
WASM_API_EXTERN wasmtime_error_t* wasmtime_module_serialize(
110-
wasmtime_module_t* module,
111-
wasm_byte_vec_t *ret
112-
);
101+
WASM_API_EXTERN wasmtime_error_t *
102+
wasmtime_module_serialize(wasmtime_module_t *module, wasm_byte_vec_t *ret);
113103

114104
/**
115105
* \brief Build a module from serialized data.
@@ -121,12 +111,9 @@ WASM_API_EXTERN wasmtime_error_t* wasmtime_module_serialize(
121111
* documentation for more information on what inputs are safe to pass in here
122112
* (e.g. only that of #wasmtime_module_serialize)
123113
*/
124-
WASM_API_EXTERN wasmtime_error_t *wasmtime_module_deserialize(
125-
wasm_engine_t *engine,
126-
const uint8_t *bytes,
127-
size_t bytes_len,
128-
wasmtime_module_t **ret
129-
);
114+
WASM_API_EXTERN wasmtime_error_t *
115+
wasmtime_module_deserialize(wasm_engine_t *engine, const uint8_t *bytes,
116+
size_t bytes_len, wasmtime_module_t **ret);
130117

131118
/**
132119
* \brief Deserialize a module from an on-disk file.
@@ -142,29 +129,27 @@ WASM_API_EXTERN wasmtime_error_t *wasmtime_module_deserialize(
142129
* documentation for more information on what inputs are safe to pass in here
143130
* (e.g. only that of #wasmtime_module_serialize)
144131
*/
145-
WASM_API_EXTERN wasmtime_error_t *wasmtime_module_deserialize_file(
146-
wasm_engine_t *engine,
147-
const char *path,
148-
wasmtime_module_t **ret
149-
);
150-
132+
WASM_API_EXTERN wasmtime_error_t *
133+
wasmtime_module_deserialize_file(wasm_engine_t *engine, const char *path,
134+
wasmtime_module_t **ret);
151135

152136
/**
153-
* \brief Returns the range of bytes in memory where this module’s compilation image resides.
137+
* \brief Returns the range of bytes in memory where this module’s compilation
138+
* image resides.
154139
*
155-
* The compilation image for a module contains executable code, data, debug information, etc.
156-
* This is roughly the same as the wasmtime_module_serialize but not the exact same.
140+
* The compilation image for a module contains executable code, data, debug
141+
* information, etc. This is roughly the same as the wasmtime_module_serialize
142+
* but not the exact same.
157143
*
158-
* For more details see: https://docs.wasmtime.dev/api/wasmtime/struct.Module.html#method.image_range
144+
* For more details see:
145+
* https://docs.wasmtime.dev/api/wasmtime/struct.Module.html#method.image_range
159146
*/
160-
WASM_API_EXTERN void wasmtime_module_image_range(
161-
const wasm_module_t *module,
162-
size_t *start,
163-
size_t *end
164-
);
147+
WASM_API_EXTERN void
148+
wasmtime_module_image_range(const wasmtime_module_t *module, size_t *start,
149+
size_t *end);
165150

166151
#ifdef __cplusplus
167-
} // extern "C"
152+
} // extern "C"
168153
#endif
169154

170155
#endif // WASMTIME_MODULE_H

0 commit comments

Comments
 (0)