Skip to content

Commit adac65a

Browse files
author
matz
committed
* gc.c (define_final): should not disclose NODE* to Ruby world.
[ruby-dev:23957] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6691 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
1 parent f30049f commit adac65a

File tree

6 files changed

+21
-18
lines changed

6 files changed

+21
-18
lines changed

ChangeLog

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
Fri Jul 23 16:40:25 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
2+
3+
* gc.c (define_final): should not disclose NODE* to Ruby world.
4+
[ruby-dev:23957]
5+
16
Fri Jul 23 09:03:16 2004 Shugo Maeda <shugo@ruby-lang.org>
27

38
* lib/net/imap.rb (disconnected?): new method. (backported from HEAD)

error.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,14 +1152,14 @@ rb_sys_warning(fmt, va_alist)
11521152

11531153
void
11541154
rb_load_fail(path)
1155-
char *path;
1155+
const char *path;
11561156
{
11571157
rb_loaderror("%s -- %s", strerror(errno), path);
11581158
}
11591159

11601160
void
11611161
rb_error_frozen(what)
1162-
char *what;
1162+
const char *what;
11631163
{
11641164
rb_raise(rb_eTypeError, "can't modify frozen %s", what);
11651165
}

gc.c

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,8 +1674,6 @@ undefine_final(os, obj)
16741674
return obj;
16751675
}
16761676

1677-
#define NODE_FINAL NODE_LIT
1678-
16791677
/*
16801678
* call-seq:
16811679
* ObjectSpace.define_finalizer(obj, aProc=proc())
@@ -1704,7 +1702,7 @@ define_final(argc, argv, os)
17041702
need_call_final = 1;
17051703
FL_SET(obj, FL_FINALIZE);
17061704

1707-
block = (VALUE)rb_node_newnode(NODE_FINAL, block, ruby_safe_level, 0);
1705+
block = rb_ary_new3(2, INT2FIX(ruby_safe_level), block);
17081706

17091707
if (!finalizer_table) {
17101708
finalizer_table = st_init_numtable();
@@ -1757,9 +1755,9 @@ run_final(obj)
17571755
}
17581756
if (finalizer_table && st_delete(finalizer_table, (st_data_t*)&obj, &table)) {
17591757
for (i=0; i<RARRAY(table)->len; i++) {
1760-
NODE *final = (NODE *)RARRAY(table)->ptr[i];
1761-
args[0] = final->nd_lit;
1762-
args[2] = final->nd_nth;
1758+
VALUE final = RARRAY(table)->ptr[i];
1759+
args[0] = FIX2INT(RARRAY(final)->ptr[0]);
1760+
args[2] = RARRAY(final)->ptr[1];
17631761
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
17641762
}
17651763
}

intern.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ NORETURN(void rb_name_error __((ID, const char*, ...)));
136136
NORETURN(void rb_invalid_str _((const char*, const char*)));
137137
void rb_compile_error __((const char*, ...));
138138
void rb_compile_error_append __((const char*, ...));
139-
NORETURN(void rb_load_fail _((char*)));
140-
NORETURN(void rb_error_frozen _((char*)));
139+
NORETURN(void rb_load_fail _((const char*)));
140+
NORETURN(void rb_error_frozen _((const char*)));
141141
void rb_check_frozen _((VALUE));
142142
/* eval.c */
143143
RUBY_EXTERN struct RNode *ruby_current_node;
@@ -363,8 +363,8 @@ const char* rb_get_kcode _((void));
363363
/* ruby.c */
364364
RUBY_EXTERN VALUE rb_argv;
365365
RUBY_EXTERN VALUE rb_argv0;
366-
void rb_load_file _((char*));
367-
void ruby_script _((char*));
366+
void rb_load_file _((const char*));
367+
void ruby_script _((const char*));
368368
void ruby_prog_init _((void));
369369
void ruby_set_argv _((int, char**));
370370
void ruby_process_options _((int, char**));

lib/date.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,11 +707,11 @@ class << self
707707

708708
def once(*ids) # :nodoc:
709709
for id in ids
710-
module_eval <<-"end;"
710+
module_eval <<-"end;", __FILE__, __LINE__
711711
alias_method :__#{id.to_i}__, :#{id.to_s}
712712
private :__#{id.to_i}__
713713
def #{id.to_s}(*args, &block)
714-
if @__#{id.to_i}__
714+
if defined? @__#{id.to_i}__
715715
@__#{id.to_i}__
716716
elsif ! self.frozen?
717717
@__#{id.to_i}__ ||= __#{id.to_i}__(*args, &block)

ruby.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ extern int ruby_yydebug;
5555
char *ruby_inplace_mode = Qfalse;
5656

5757
static void load_stdin _((void));
58-
static void load_file _((char *, int));
58+
static void load_file _((const char *, int));
5959
static void forbid_setid _((const char *));
6060

6161
static VALUE do_loop = Qfalse, do_print = Qfalse;
@@ -795,7 +795,7 @@ extern int ruby__end__seen;
795795

796796
static void
797797
load_file(fname, script)
798-
char *fname;
798+
const char *fname;
799799
int script;
800800
{
801801
extern VALUE rb_stdin;
@@ -918,7 +918,7 @@ load_file(fname, script)
918918

919919
void
920920
rb_load_file(fname)
921-
char *fname;
921+
const char *fname;
922922
{
923923
load_file(fname, 0);
924924
}
@@ -1004,7 +1004,7 @@ set_arg0(val, id)
10041004

10051005
void
10061006
ruby_script(name)
1007-
char *name;
1007+
const char *name;
10081008
{
10091009
if (name) {
10101010
rb_progname = rb_tainted_str_new2(name);

0 commit comments

Comments
 (0)