[wasm-api] Add buffer-contents-free
This commit is contained in:
parent
d38f02ab30
commit
851ef1380a
|
@ -33,6 +33,19 @@ namespace hb {
|
|||
namespace wasm {
|
||||
|
||||
|
||||
void
|
||||
buffer_contents_free (HB_WASM_EXEC_ENV
|
||||
ptr_t(buffer_contents_t) contentsptr)
|
||||
{
|
||||
if (unlikely (!validate_app_addr (contentsptr, sizeof (buffer_contents_t))))
|
||||
return;
|
||||
|
||||
buffer_contents_t *contents = (buffer_contents_t *) addr_app_to_native (contentsptr);
|
||||
|
||||
module_free (contents->info);
|
||||
module_free (contents->pos);
|
||||
}
|
||||
|
||||
void
|
||||
buffer_copy_contents (HB_WASM_EXEC_ENV_COMPOUND
|
||||
ptr_t(buffer_t) bufferref)
|
||||
|
|
|
@ -55,6 +55,7 @@ static NativeSymbol _hb_wasm_native_symbols[] =
|
|||
NATIVE_SYMBOL ("(i)", blob_free),
|
||||
|
||||
/* buffer */
|
||||
NATIVE_SYMBOL ("(i)", buffer_contents_free),
|
||||
NATIVE_SYMBOL ("(ii)", buffer_copy_contents),
|
||||
|
||||
/* face */
|
||||
|
|
|
@ -85,7 +85,7 @@ typedef struct
|
|||
} blob_t;
|
||||
|
||||
HB_WASM_API (void, blob_free) (HB_WASM_EXEC_ENV
|
||||
ptr_t(blob_t) blob);
|
||||
ptr_t(blob_t));
|
||||
|
||||
|
||||
/* buffer */
|
||||
|
@ -115,7 +115,8 @@ typedef struct
|
|||
ptr_t(glyph_position_t) pos;
|
||||
} buffer_contents_t;
|
||||
|
||||
/* TODO buffer_contents_free */
|
||||
HB_WASM_API (void, buffer_contents_free) (HB_WASM_EXEC_ENV
|
||||
ptr_t(buffer_contents_t));
|
||||
|
||||
typedef struct buffer_t buffer_t;
|
||||
|
||||
|
|
|
@ -25,5 +25,7 @@ shape (font_t *font, buffer_t *buffer)
|
|||
for (unsigned i = 0; i < contents.length; i++)
|
||||
debugprint2 ("Codepoint", i, contents.info[i].codepoint);
|
||||
|
||||
buffer_contents_free (&contents);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue