From 4c8a414a101c9657fda42d2fdb9789407b034c99 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Thu, 23 Feb 2023 10:22:12 -0700 Subject: [PATCH] [wasm-api] Clean up debugprint --- src/hb-wasm-api.hh | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/hb-wasm-api.hh b/src/hb-wasm-api.hh index 43f5d217a..d7bfd322d 100644 --- a/src/hb-wasm-api.hh +++ b/src/hb-wasm-api.hh @@ -46,12 +46,20 @@ #include "hb-wasm-font.hh" +#ifdef HB_DEBUG_WASM +namespace hb { namespace wasm { +static void +debugprint (HB_WASM_EXEC_ENV + char *the_string, uint32_t len) +{ + printf("%.*s", (int) len, the_string); +} +}} +#endif #undef module_inst +#undef HB_WASM_EXEC_ENV -static void debugprint(wasm_exec_env_t exec_env, char *the_string, uint8_t len) { - printf("%.*s", len, the_string); -} /* Define an array of NativeSymbol for the APIs to be exported. @@ -65,12 +73,7 @@ static void debugprint(wasm_exec_env_t exec_env, char *the_string, uint8_t len) { NATIVE_SYMBOL ("(i)i", font_get_face), #ifdef HB_DEBUG_WASM - { - "debugprint", - (void *) debugprint, - "($i)", - NULL - } + NATIVE_SYMBOL ("($i)", debugprint), #endif }; #undef NATIVE_SYMBOL