Skip to content

Commit f610abc

Browse files
committed
* main.c, goruby.c (RUBY_MAIN_INIT): removed.
* goruby.c (goruby_run_node): run after ruby_init_loadpath() so that require works, and protect the call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14808 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent 74dd31f commit f610abc

File tree

3 files changed

+29
-4
lines changed

3 files changed

+29
-4
lines changed

ChangeLog

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Mon Dec 31 07:39:31 2007 Nobuyoshi Nakada <[email protected]>
2+
3+
* main.c, goruby.c (RUBY_MAIN_INIT): removed.
4+
5+
* goruby.c (goruby_run_node): run after ruby_init_loadpath() so that
6+
require works, and protect the call.
7+
18
Mon Dec 31 06:50:38 2007 Nobuyoshi Nakada <[email protected]>
29

310
* trunk/common.mk: not use -I$(srcdir)/lib with $(MINIRUBY) for cross

goruby.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
11
void Init_golf(void);
2-
#define RUBY_MAIN_INIT() Init_golf()
2+
#define ruby_run_node goruby_run_node
33
#include "main.c"
4+
#undef ruby_run_node
5+
6+
RUBY_EXTERN int ruby_run_node(void*);
7+
RUBY_EXTERN void ruby_init_ext(const char *name, void (*init)(void));
8+
9+
static VALUE
10+
init_golf(VALUE arg)
11+
{
12+
ruby_init_ext("golf", Init_golf);
13+
return arg;
14+
}
15+
16+
int
17+
goruby_run_node(void *arg)
18+
{
19+
int state;
20+
if (NIL_P(rb_protect(init_golf, Qtrue, &state))) {
21+
return state == EXIT_SUCCESS ? EXIT_FAILURE : state;
22+
}
23+
return ruby_run_node(arg);
24+
}

main.c

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ main(int argc, char **argv, char **envp)
3333
{
3434
RUBY_INIT_STACK;
3535
ruby_init();
36-
#ifdef RUBY_MAIN_INIT
37-
RUBY_MAIN_INIT();
38-
#endif
3936
return ruby_run_node(ruby_options(argc, argv));
4037
}
4138
}

0 commit comments

Comments
 (0)