1
1
#include "_CJavaScriptKit.h"
2
2
#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
7
7
extern void * malloc (size_t size );
8
8
extern void free (void * ptr );
9
9
extern void * memset (void * , int , size_t );
10
10
extern 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>
14
14
15
- #endif
15
+ # endif
16
16
/// The compatibility runtime library version.
17
17
/// Notes: If you change any interface of runtime library, please increment
18
18
/// this and `SwiftRuntime.version` in `./Runtime/src/index.ts`.
@@ -34,7 +34,7 @@ void swjs_cleanup_host_function_call(void *argv_buffer) {
34
34
// NOTE: This __wasi__ check is a hack for Embedded compatibility (assuming that if __wasi__ is defined, we are not building for Embedded)
35
35
// cdecls don't work in Embedded, but @_expose(wasm) can be used with Swift >=6.0
36
36
// 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__
38
38
bool _call_host_function_impl (const JavaScriptHostFuncRef host_func_ref ,
39
39
const RawJSValue * argv , const int argc ,
40
40
const JavaScriptObjectRef callback_func );
@@ -59,6 +59,8 @@ __attribute__((export_name("swjs_library_features")))
59
59
int swjs_library_features (void ) {
60
60
return _library_features ();
61
61
}
62
+ # endif
63
+ #endif
62
64
63
65
int swjs_get_worker_thread_id_cached (void ) {
64
66
_Thread_local static int tid = 0 ;
@@ -67,5 +69,3 @@ int swjs_get_worker_thread_id_cached(void) {
67
69
}
68
70
return tid ;
69
71
}
70
- #endif
71
- #endif
0 commit comments