ruby-changes:4818
From: ko1@a...
Date: Wed, 7 May 2008 18:18:25 +0900 (JST)
Subject: [ruby-changes:4818] matz - Ruby:r16312 (trunk): * string.c (sym_to_i): remove obsolete method. preparation for
matz 2008-05-07 18:18:06 +0900 (Wed, 07 May 2008) New Revision: 16312 Modified files: trunk/ChangeLog trunk/numeric.c trunk/test/ruby/test_fixnum.rb Log: * string.c (sym_to_i): remove obsolete method. preparation for symbol GC. * numeric.c (fix_to_sym): ditto. * numeric.c (fix_id2name): ditto. http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/numeric.c?r1=16312&r2=16311&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/test/ruby/test_fixnum.rb?r1=16312&r2=16311&diff_format=u http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=16312&r2=16311&diff_format=u Index: ChangeLog =================================================================== --- ChangeLog (revision 16311) +++ ChangeLog (revision 16312) @@ -1,3 +1,12 @@ +Wed May 7 18:02:01 2008 Yukihiro Matsumoto <matz@r...> + + * string.c (sym_to_i): remove obsolete method. preparation for + symbol GC. + + * numeric.c (fix_to_sym): ditto. + + * numeric.c (fix_id2name): ditto. + Wed May 7 17:43:22 2008 Nobuyoshi Nakada <nobu@r...> * io.c (io_puts_ary): check recursion first. [ruby-dev:34580] Index: numeric.c =================================================================== --- numeric.c (revision 16311) +++ numeric.c (revision 16312) @@ -2850,56 +2850,10 @@ return LONG2NUM(i); } -/* - * call-seq: - * fix.id2name -> string or nil - * - * Returns the name of the object whose symbol id is <i>fix</i>. If - * there is no symbol in the symbol table with this value, returns - * <code>nil</code>. <code>id2name</code> has nothing to do with the - * <code>Object.id</code> method. See also <code>Fixnum#to_sym</code>, - * <code>String#intern</code>, and class <code>Symbol</code>. - * - * symbol = :@inst_var #=> :@inst_var - * id = symbol.to_i #=> 9818 - * id.id2name #=> "@inst_var" - */ -static VALUE -fix_id2name(VALUE fix) -{ - VALUE name = rb_id2str(FIX2UINT(fix)); - if (name) return rb_str_dup(name); - return Qnil; -} - /* * call-seq: - * fix.to_sym -> aSymbol - * - * Returns the symbol whose integer value is <i>fix</i>. See also - * <code>Fixnum#id2name</code>. - * - * fred = :fred.to_i - * fred.id2name #=> "fred" - * fred.to_sym #=> :fred - */ - -static VALUE -fix_to_sym(VALUE fix) -{ - ID id = FIX2UINT(fix); - - if (rb_id2name(id)) { - return ID2SYM(id); - } - return Qnil; -} - - -/* - * call-seq: * fix.size -> fixnum * * Returns the number of <em>bytes</em> in the machine representation @@ -3205,9 +3159,6 @@ rb_define_method(rb_cFixnum, "to_s", fix_to_s, -1); - rb_define_method(rb_cFixnum, "id2name", fix_id2name, 0); - rb_define_method(rb_cFixnum, "to_sym", fix_to_sym, 0); - rb_define_method(rb_cFixnum, "-@", fix_uminus, 0); rb_define_method(rb_cFixnum, "+", fix_plus, 1); rb_define_method(rb_cFixnum, "-", fix_minus, 1); Index: test/ruby/test_fixnum.rb =================================================================== --- test/ruby/test_fixnum.rb (revision 16311) +++ test/ruby/test_fixnum.rb (revision 16312) @@ -238,11 +238,4 @@ assert(!(1.send(:<=, 0.0))) assert_raise(ArgumentError) { 1.send(:<=, nil) } end - - def test_id2name - assert_equal("foo", :foo.to_i.id2name) - assert_nil(0.id2name) - assert_equal(:foo, :foo.to_i.to_sym) - assert_nil(0.to_sym) - end end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/