summaryrefslogtreecommitdiff
path: root/gc.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-05 08:12:18 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2007-07-05 08:12:18 +0000
commit46603a78afde1386f92b38f9b16ca86daa93ad88 (patch)
treef3594fecc31b6f210f95143c7a20c2ea55ae68ce /gc.c
parenta0d50fa3c494ea5afb98c05be049a0cde6fde28d (diff)
* include/ruby/{intern,ruby}.h, compile.[ch], error.c, eval.c,
eval_load.c, gc.c, iseq.c, main.c, parse.y, re.c, ruby.c, yarvcore.[ch] (ruby_eval_tree, ruby_sourcefile, ruby_sourceline, ruby_nerrs): purge global variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12700 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'gc.c')
-rw-r--r--gc.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/gc.c b/gc.c
index a21ced7bd9..d596d10735 100644
--- a/gc.c
+++ b/gc.c
@@ -529,6 +529,21 @@ rb_newobj(void)
#endif
}
+NODE*
+rb_node_newnode(enum node_type type, VALUE a0, VALUE a1, VALUE a2)
+{
+ NODE *n = (NODE*)rb_newobj();
+
+ n->flags |= T_NODE;
+ nd_set_type(n, type);
+
+ n->u1.value = a0;
+ n->u2.value = a1;
+ n->u3.value = a2;
+
+ return n;
+}
+
VALUE
rb_data_object_alloc(VALUE klass, void *datap, RUBY_DATA_FUNC dmark, RUBY_DATA_FUNC dfree)
{
@@ -634,8 +649,8 @@ rb_source_filename(const char *f)
return (char *)name + 1;
}
-static void
-mark_source_filename(char *f)
+void
+rb_mark_source_filename(char *f)
{
if (f) {
f[-1] = 1;
@@ -843,7 +858,7 @@ gc_mark_children(VALUE ptr, int lev)
break;
case T_NODE:
- mark_source_filename(obj->as.node.nd_file);
+ rb_mark_source_filename(obj->as.node.nd_file);
switch (nd_type(obj)) {
case NODE_IF: /* 1,2,3 */
case NODE_FOR:
@@ -1119,7 +1134,6 @@ gc_sweep(void)
if (free_min < FREE_MIN)
free_min = FREE_MIN;
- mark_source_filename(ruby_sourcefile);
if (source_filenames) {
st_foreach(source_filenames, sweep_source_filename, 0);
}
@@ -1426,8 +1440,8 @@ garbage_collect(void)
rb_gc_mark_parser();
/* gc_mark objects whose marking are not completed*/
- while (!MARK_STACK_EMPTY){
- if (mark_stack_overflow){
+ while (!MARK_STACK_EMPTY) {
+ if (mark_stack_overflow) {
gc_mark_all();
}
else {