From: Michal Rokos Date: 2002-04-11T08:34:48+09:00 Subject: Small cleanup for ruby-1.7-cvs Hello, I'm sorry to bug you like this, but I don't know if I can disturb Matz directly... This is a really small cleanup for ruby_verbose variable. BR Michal Index: eval.c =================================================================== RCS file: /src/ruby/eval.c,v retrieving revision 1.279 diff -u -r1.279 eval.c --- eval.c 2002/04/08 07:09:45 1.279 +++ eval.c 2002/04/10 22:57:48 @@ -3935,7 +3935,7 @@ break; case NODE_CVDECL: - if (ruby_verbose && FL_TEST(ruby_cbase, FL_SINGLETON)) { + if (RTEST(ruby_verbose) && FL_TEST(ruby_cbase, FL_SINGLETON)) { rb_warn("declaring singleton class variable"); } rb_cvar_set(cvar_cbase(), lhs->nd_vid, val, Qtrue); Index: object.c =================================================================== RCS file: /src/ruby/object.c,v retrieving revision 1.75 diff -u -r1.75 object.c --- object.c 2002/03/08 07:03:03 1.75 +++ object.c 2002/04/10 22:57:49 @@ -1116,7 +1116,7 @@ { StringValue(str); if (len) *len = RSTRING(str)->len; - else if (ruby_verbose && RSTRING(str)->len != strlen(RSTRING(str)->ptr)) { + else if (RTEST(ruby_verbose) && RSTRING(str)->len != strlen(RSTRING(str)->ptr)) { rb_warn("string contains \\0 character"); } return RSTRING(str)->ptr; Index: parse.y =================================================================== RCS file: /src/ruby/parse.y,v retrieving revision 1.164 diff -u -r1.164 parse.y --- parse.y 2002/03/26 06:18:49 1.164 +++ parse.y 2002/04/10 22:57:50 @@ -4648,7 +4648,7 @@ { char *useless = 0; - if (!ruby_verbose) return; + if (!RTEST(ruby_verbose)) return; if (!node) return; again: @@ -4742,7 +4742,7 @@ void_stmts(node) NODE *node; { - if (!ruby_verbose) return; + if (!RTEST(ruby_verbose)) return; if (!node) return; if (nd_type(node) != NODE_BLOCK) return; Index: variable.c =================================================================== RCS file: /src/ruby/variable.c,v retrieving revision 1.62 diff -u -r1.62 variable.c --- variable.c 2002/04/10 08:45:22 1.62 +++ variable.c 2002/04/10 22:57:50 @@ -353,9 +353,8 @@ undef_getter(id) ID id; { - if (ruby_verbose) { - rb_warning("global variable `%s' not initialized", rb_id2name(id)); - } + rb_warning("global variable `%s' not initialized", rb_id2name(id)); + return Qnil; } @@ -945,9 +944,8 @@ return generic_ivar_get(obj, id); break; } - if (ruby_verbose) { - rb_warning("instance variable %s not initialized", rb_id2name(id)); - } + rb_warning("instance variable %s not initialized", rb_id2name(id)); + return Qnil; } @@ -1461,11 +1459,11 @@ if (OBJ_FROZEN(tmp)) rb_error_frozen("class/module"); if (!OBJ_TAINTED(tmp) && rb_safe_level() >= 4) rb_raise(rb_eSecurityError, "Insecure: can't modify class variable"); - if (warn && ruby_verbose && klass != tmp) { + if (warn && RTEST(ruby_verbose) && klass != tmp) { rb_warning("already initialized class variable %s", rb_id2name(id)); } st_insert(RCLASS(tmp)->iv_tbl,id,val); - if (ruby_verbose) { + if (RTEST(ruby_verbose)) { cvar_override_check(id, tmp); } return; @@ -1488,7 +1486,7 @@ while (tmp) { if (RCLASS(tmp)->iv_tbl) { if (st_lookup(RCLASS(tmp)->iv_tbl,id,&value)) { - if (ruby_verbose) { + if (RTEST(ruby_verbose)) { cvar_override_check(id, tmp); } return value; -- -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Michal Rokos Czech Technical University, Prague E-mail:m.rokos@sh.cvut.cz ICQ:36118339 Jabber:majkl@jabber.sh.cvut.cz -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-