From bc5d30584353fc9770f6009cb8017260af5a98c6 Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 22 Sep 2007 21:16:21 +0000 Subject: [PATCH] * eval_method.ci (remove_method): check for undefined method. [ruby-dev:31816] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13491 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ eval_method.ci | 19 ++++++++++++------- version.h | 6 +++--- 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5454b66c14..6e79c74520 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Sun Sep 23 06:16:04 2007 Nobuyoshi Nakada + + * eval_method.ci (remove_method): check for undefined method. + [ruby-dev:31816] + Sun Sep 23 05:42:35 2007 URABE Shyouhei * lib/rdoc/options.rb (Options::check_diagram): dot -V output diff --git a/eval_method.ci b/eval_method.ci index 08ba953374..762e05aff7 100644 --- a/eval_method.ci +++ b/eval_method.ci @@ -140,9 +140,11 @@ rb_add_method(VALUE klass, ID mid, NODE * node, int noex) { /* check re-definition */ + st_data_t data; NODE *old_node; - if (st_lookup(RCLASS(klass)->m_tbl, mid, (st_data_t *)&old_node)) { + if (st_lookup(RCLASS(klass)->m_tbl, mid, &data)) { + old_node = (NODE *)data; if (old_node) { if (nd_type(old_node->nd_body->nd_body) == NODE_CFUNC) { rb_vm_check_redefinition_opt_method(old_node); @@ -208,13 +210,13 @@ rb_get_alloc_func(VALUE klass) static NODE * search_method(VALUE klass, ID id, VALUE *klassp) { - NODE *body; + st_data_t body; if (!klass) { return 0; } - while (!st_lookup(RCLASS(klass)->m_tbl, id, (st_data_t *) & body)) { + while (!st_lookup(RCLASS(klass)->m_tbl, id, &body)) { klass = RCLASS(klass)->super; if (!klass) return 0; @@ -224,7 +226,7 @@ search_method(VALUE klass, ID id, VALUE *klassp) *klassp = klass; } - return body; + return (NODE *)body; } /* @@ -289,6 +291,7 @@ rb_method_node(VALUE klass, ID id) static void remove_method(VALUE klass, ID mid) { + st_data_t data; NODE *body; if (klass == rb_cObject) { @@ -302,8 +305,8 @@ remove_method(VALUE klass, ID mid) if (mid == object_id || mid == __send || mid == __send_bang || mid == init) { rb_warn("removing `%s' may cause serious problem", rb_id2name(mid)); } - if (!st_delete(RCLASS(klass)->m_tbl, &mid, (st_data_t *) & body) || - !body->nd_body) { + if (!st_delete(RCLASS(klass)->m_tbl, &mid, &data) || + !(body = (NODE *)data) || !body->nd_body) { rb_name_error(mid, "method `%s' not defined in %s", rb_id2name(mid), rb_class2name(klass)); } @@ -556,6 +559,7 @@ rb_alias(VALUE klass, ID name, ID def) { NODE *orig_fbody, *node; VALUE singleton = 0; + st_data_t data; rb_frozen_class_p(klass); if (name == def) @@ -578,7 +582,8 @@ rb_alias(VALUE klass, ID name, ID def) orig_fbody->nd_cnt++; - if (st_lookup(RCLASS(klass)->m_tbl, name, (st_data_t *) & node)) { + if (st_lookup(RCLASS(klass)->m_tbl, name, &data)) { + node = (NODE *)data; if (node) { if (RTEST(ruby_verbose) && node->nd_cnt == 0 && node->nd_body) { rb_warning("discarding old %s", rb_id2name(name)); diff --git a/version.h b/version.h index c8e3db8178..8d7aeae7c5 100644 --- a/version.h +++ b/version.h @@ -1,7 +1,7 @@ #define RUBY_VERSION "1.9.0" -#define RUBY_RELEASE_DATE "2007-09-22" +#define RUBY_RELEASE_DATE "2007-09-23" #define RUBY_VERSION_CODE 190 -#define RUBY_RELEASE_CODE 20070922 +#define RUBY_RELEASE_CODE 20070923 #define RUBY_PATCHLEVEL 0 #define RUBY_VERSION_MAJOR 1 @@ -9,7 +9,7 @@ #define RUBY_VERSION_TEENY 0 #define RUBY_RELEASE_YEAR 2007 #define RUBY_RELEASE_MONTH 9 -#define RUBY_RELEASE_DAY 22 +#define RUBY_RELEASE_DAY 23 #ifdef RUBY_EXTERN RUBY_EXTERN const char ruby_version[];