11#include "_CJavaScriptKit.h"
22#if __wasm32__
3- #ifndef __wasi__
4- #if __has_include ("malloc.h" )
5- #include <malloc.h>
6- #endif
3+ # ifndef __wasi__
4+ # if __has_include ("malloc.h" )
5+ # include <malloc.h>
6+ # endif
77extern void * malloc (size_t size );
88extern void free (void * ptr );
99extern void * memset (void * , int , size_t );
1010extern void * memcpy (void * __restrict, const void * __restrict, size_t );
11- #else
12- #include <stdlib.h>
13- #include <stdbool.h>
11+ # else
12+ # include <stdlib.h>
13+ # include <stdbool.h>
1414
15- #endif
15+ # endif
1616/// The compatibility runtime library version.
1717/// Notes: If you change any interface of runtime library, please increment
1818/// this and `SwiftRuntime.version` in `./Runtime/src/index.ts`.
@@ -34,7 +34,7 @@ void swjs_cleanup_host_function_call(void *argv_buffer) {
3434// NOTE: This __wasi__ check is a hack for Embedded compatibility (assuming that if __wasi__ is defined, we are not building for Embedded)
3535// cdecls don't work in Embedded, but @_expose(wasm) can be used with Swift >=6.0
3636// the previously used `#if __Embedded` did not play well with SwiftPM (defines needed to be on every target up the chain)
37- #ifdef __wasi__
37+ # ifdef __wasi__
3838bool _call_host_function_impl (const JavaScriptHostFuncRef host_func_ref ,
3939 const RawJSValue * argv , const int argc ,
4040 const JavaScriptObjectRef callback_func );
@@ -59,6 +59,8 @@ __attribute__((export_name("swjs_library_features")))
5959int swjs_library_features (void ) {
6060 return _library_features ();
6161}
62+ # endif
63+ #endif
6264
6365int swjs_get_worker_thread_id_cached (void ) {
6466 _Thread_local static int tid = 0 ;
@@ -67,5 +69,3 @@ int swjs_get_worker_thread_id_cached(void) {
6769 }
6870 return tid ;
6971}
70- #endif
71- #endif
0 commit comments