summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-12 03:36:49 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-12-12 03:36:49 +0000
commitf7d72f1e6550af0571f15fb93327eb7c901fb104 (patch)
tree8c8b3ce8575b17c778a2ab67a2e893ac8af6d3b4
parente585523a2b60a69befc1562fd4c79cfa688bb197 (diff)
precedes registering global VALUE variables before initializing it.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9677 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--eval.c8
-rw-r--r--gc.c6
-rw-r--r--io.c11
-rw-r--r--object.c2
4 files changed, 14 insertions, 13 deletions
diff --git a/eval.c b/eval.c
index b43846ef60..58971b1286 100644
--- a/eval.c
+++ b/eval.c
@@ -7777,8 +7777,8 @@ Init_eval()
rb_define_method(rb_mKernel, "respond_to?", obj_respond_to, -1);
respond_to = rb_intern("respond_to?");
- basic_respond_to = rb_method_node(rb_cObject, respond_to);
rb_global_variable((VALUE*)&basic_respond_to);
+ basic_respond_to = rb_method_node(rb_cObject, respond_to);
rb_define_global_function("raise", rb_f_raise, -1);
rb_define_global_function("fail", rb_f_raise, -1);
@@ -9446,13 +9446,13 @@ Init_Proc()
rb_define_method(rb_eLocalJumpError, "exit_value", localjump_xvalue, 0);
rb_define_method(rb_eLocalJumpError, "reason", localjump_reason, 0);
- exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
rb_global_variable(&exception_error);
+ exception_error = rb_exc_new2(rb_eFatal, "exception reentered");
rb_eSysStackError = rb_define_class("SystemStackError", rb_eStandardError);
+ rb_global_variable(&sysstack_error);
sysstack_error = rb_exc_new2(rb_eSysStackError, "stack level too deep");
OBJ_TAINT(sysstack_error);
- rb_global_variable(&sysstack_error);
rb_cProc = rb_define_class("Proc", rb_cObject);
rb_undef_alloc_func(rb_cProc);
@@ -12759,9 +12759,9 @@ Init_Thread()
rb_define_method(cThGroup, "enclose", thgroup_enclose, 0);
rb_define_method(cThGroup, "enclosed?", thgroup_enclosed_p, 0);
rb_define_method(cThGroup, "add", thgroup_add, 1);
+ rb_global_variable(&thgroup_default);
thgroup_default = rb_obj_alloc(cThGroup);
rb_define_const(cThGroup, "Default", thgroup_default);
- rb_global_variable(&thgroup_default);
/* allocate main thread */
main_thread = rb_thread_alloc(rb_cThread);
diff --git a/gc.c b/gc.c
index d076898fd7..c172a0841d 100644
--- a/gc.c
+++ b/gc.c
@@ -1053,7 +1053,9 @@ gc_sweep()
}
mark_source_filename(ruby_sourcefile);
- st_foreach(source_filenames, sweep_source_filename, 0);
+ if (source_filenames) {
+ st_foreach(source_filenames, sweep_source_filename, 0);
+ }
freelist = 0;
final_list = deferred_final_list;
@@ -1938,6 +1940,6 @@ Init_GC()
source_filenames = st_init_strtable();
- nomem_error = rb_exc_new2(rb_eNoMemError, "failed to allocate memory");
rb_global_variable(&nomem_error);
+ nomem_error = rb_exc_new2(rb_eNoMemError, "failed to allocate memory");
}
diff --git a/io.c b/io.c
index 49d6eb9076..826285842c 100644
--- a/io.c
+++ b/io.c
@@ -5668,12 +5668,12 @@ Init_IO()
rb_define_method(rb_cIO, "pid", rb_io_pid, 0);
rb_define_method(rb_cIO, "inspect", rb_io_inspect, 0);
- rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO);
rb_define_variable("$stdin", &rb_stdin);
- rb_stdout = prep_stdio(stdout, FMODE_WRITABLE, rb_cIO);
+ rb_stdin = prep_stdio(stdin, FMODE_READABLE, rb_cIO);
rb_define_hooked_variable("$stdout", &rb_stdout, 0, stdout_setter);
- rb_stderr = prep_stdio(stderr, FMODE_WRITABLE, rb_cIO);
+ rb_stdout = prep_stdio(stdout, FMODE_WRITABLE, rb_cIO);
rb_define_hooked_variable("$stderr", &rb_stderr, 0, stdout_setter);
+ rb_stderr = prep_stdio(stderr, FMODE_WRITABLE, rb_cIO);
rb_define_hooked_variable("$>", &rb_stdout, 0, stdout_setter);
orig_stdout = rb_stdout;
rb_deferr = orig_stderr = rb_stderr;
@@ -5687,10 +5687,9 @@ Init_IO()
rb_define_global_const("STDOUT", rb_stdout);
rb_define_global_const("STDERR", rb_stderr);
+ rb_define_readonly_variable("$<", &argf);
argf = rb_obj_alloc(rb_cObject);
rb_extend_object(argf, rb_mEnumerable);
-
- rb_define_readonly_variable("$<", &argf);
rb_define_global_const("ARGF", argf);
rb_define_singleton_method(argf, "to_s", argf_to_s, 0);
@@ -5729,8 +5728,8 @@ Init_IO()
rb_define_singleton_method(argf, "lineno=", argf_set_lineno, 1);
rb_global_variable(&current_file);
- filename = rb_str_new2("-");
rb_define_readonly_variable("$FILENAME", &filename);
+ filename = rb_str_new2("-");
rb_define_virtual_variable("$-i", opt_i_get, opt_i_set);
diff --git a/object.c b/object.c
index 837e74cb90..d1a57bc73a 100644
--- a/object.c
+++ b/object.c
@@ -2753,8 +2753,8 @@ Init_Object()
rb_cData = rb_define_class("Data", rb_cObject);
rb_undef_alloc_func(rb_cData);
- ruby_top_self = rb_obj_alloc(rb_cObject);
rb_global_variable(&ruby_top_self);
+ ruby_top_self = rb_obj_alloc(rb_cObject);
rb_define_singleton_method(ruby_top_self, "to_s", main_to_s, 0);
rb_cTrueClass = rb_define_class("TrueClass", rb_cObject);