1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
matz 2004-07-23 07:52:38 +00:00
parent f30049f4ab
commit adac65af93
6 changed files with 21 additions and 18 deletions

View file

@ -1,3 +1,8 @@
Fri Jul 23 16:40:25 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
* gc.c (define_final): should not disclose NODE* to Ruby world.
[ruby-dev:23957]
Fri Jul 23 09:03:16 2004 Shugo Maeda <shugo@ruby-lang.org>
* lib/net/imap.rb (disconnected?): new method. (backported from HEAD)

View file

@ -1152,14 +1152,14 @@ rb_sys_warning(fmt, va_alist)
void
rb_load_fail(path)
char *path;
const char *path;
{
rb_loaderror("%s -- %s", strerror(errno), path);
}
void
rb_error_frozen(what)
char *what;
const char *what;
{
rb_raise(rb_eTypeError, "can't modify frozen %s", what);
}

10
gc.c
View file

@ -1674,8 +1674,6 @@ undefine_final(os, obj)
return obj;
}
#define NODE_FINAL NODE_LIT
/*
* call-seq:
* ObjectSpace.define_finalizer(obj, aProc=proc())
@ -1704,7 +1702,7 @@ define_final(argc, argv, os)
need_call_final = 1;
FL_SET(obj, FL_FINALIZE);
block = (VALUE)rb_node_newnode(NODE_FINAL, block, ruby_safe_level, 0);
block = rb_ary_new3(2, INT2FIX(ruby_safe_level), block);
if (!finalizer_table) {
finalizer_table = st_init_numtable();
@ -1757,9 +1755,9 @@ run_final(obj)
}
if (finalizer_table && st_delete(finalizer_table, (st_data_t*)&obj, &table)) {
for (i=0; i<RARRAY(table)->len; i++) {
NODE *final = (NODE *)RARRAY(table)->ptr[i];
args[0] = final->nd_lit;
args[2] = final->nd_nth;
VALUE final = RARRAY(table)->ptr[i];
args[0] = FIX2INT(RARRAY(final)->ptr[0]);
args[2] = RARRAY(final)->ptr[1];
rb_protect((VALUE(*)_((VALUE)))run_single_final, (VALUE)args, &status);
}
}

View file

@ -136,8 +136,8 @@ NORETURN(void rb_name_error __((ID, const char*, ...)));
NORETURN(void rb_invalid_str _((const char*, const char*)));
void rb_compile_error __((const char*, ...));
void rb_compile_error_append __((const char*, ...));
NORETURN(void rb_load_fail _((char*)));
NORETURN(void rb_error_frozen _((char*)));
NORETURN(void rb_load_fail _((const char*)));
NORETURN(void rb_error_frozen _((const char*)));
void rb_check_frozen _((VALUE));
/* eval.c */
RUBY_EXTERN struct RNode *ruby_current_node;
@ -363,8 +363,8 @@ const char* rb_get_kcode _((void));
/* ruby.c */
RUBY_EXTERN VALUE rb_argv;
RUBY_EXTERN VALUE rb_argv0;
void rb_load_file _((char*));
void ruby_script _((char*));
void rb_load_file _((const char*));
void ruby_script _((const char*));
void ruby_prog_init _((void));
void ruby_set_argv _((int, char**));
void ruby_process_options _((int, char**));

View file

@ -707,11 +707,11 @@ class Date
def once(*ids) # :nodoc:
for id in ids
module_eval <<-"end;"
module_eval <<-"end;", __FILE__, __LINE__
alias_method :__#{id.to_i}__, :#{id.to_s}
private :__#{id.to_i}__
def #{id.to_s}(*args, &block)
if @__#{id.to_i}__
if defined? @__#{id.to_i}__
@__#{id.to_i}__
elsif ! self.frozen?
@__#{id.to_i}__ ||= __#{id.to_i}__(*args, &block)

8
ruby.c
View file

@ -55,7 +55,7 @@ extern int ruby_yydebug;
char *ruby_inplace_mode = Qfalse;
static void load_stdin _((void));
static void load_file _((char *, int));
static void load_file _((const char *, int));
static void forbid_setid _((const char *));
static VALUE do_loop = Qfalse, do_print = Qfalse;
@ -795,7 +795,7 @@ extern int ruby__end__seen;
static void
load_file(fname, script)
char *fname;
const char *fname;
int script;
{
extern VALUE rb_stdin;
@ -918,7 +918,7 @@ load_file(fname, script)
void
rb_load_file(fname)
char *fname;
const char *fname;
{
load_file(fname, 0);
}
@ -1004,7 +1004,7 @@ set_arg0(val, id)
void
ruby_script(name)
char *name;
const char *name;
{
if (name) {
rb_progname = rb_tainted_str_new2(name);