diff --git a/main.c b/main.c index 5cffa24cc8..e76228713f 100644 --- a/main.c +++ b/main.c @@ -32,6 +32,19 @@ static int rb_main(int argc, char **argv) +{ + RUBY_INIT_STACK; + ruby_init(); + return ruby_run_node(ruby_options(argc, argv)); +} + +#if defined(__wasm__) && !defined(__EMSCRIPTEN__) +int rb_wasm_rt_start(int (main)(int argc, char **argv), int argc, char **argv); +#define rb_main(argc, argv) rb_wasm_rt_start(rb_main, argc, argv) +#endif + +int +main(int argc, char **argv) { #ifdef RUBY_DEBUG_ENV ruby_set_debug_option(getenv("RUBY_DEBUG")); @@ -41,20 +54,5 @@ rb_main(int argc, char **argv) #endif ruby_sysinit(&argc, &argv); - { - RUBY_INIT_STACK; - ruby_init(); - return ruby_run_node(ruby_options(argc, argv)); - } -} - -int -main(int argc, char **argv) -{ -#if defined(__wasm__) && !defined(__EMSCRIPTEN__) - int rb_wasm_rt_start(int (main)(int argc, char **argv), int argc, char **argv); - return rb_wasm_rt_start(rb_main, argc, argv); -#else return rb_main(argc, argv); -#endif }