From b154c9488ec0e660ac4ebe7e14bede39f064d731 Mon Sep 17 00:00:00 2001 From: matz Date: Wed, 27 Oct 2004 02:46:54 +0000 Subject: * string.c (RESIZE_CAPA): check string attribute before modifying capacity member of string structure. [ruby-dev:24594] * ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain performance. [ruby-talk:117701] * sprintf.c (rb_f_sprintf): raise ArgumentError for extra arguments, unless (digit)$ style used. * ext/zlib/zlib.c (gzreader_gets): use memchr() to to gain performance. [ruby-talk:117701] * sprintf.c (rb_f_sprintf): raise ArgumentError for extra arguments, unless (digit)$ style used. * eval.c (frame_free): Guy Decoux solved the leak problem. Thanks. [ruby-core:03549] * ext/zlib/zlib.c (zstream_append_input): clear klass for z->input to avoid potential vulnerability. git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@7119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- object.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'object.c') diff --git a/object.c b/object.c index eda0114f6..5fd722b33 100644 --- a/object.c +++ b/object.c @@ -1118,7 +1118,6 @@ rb_obj_pattern_match(obj1, obj2) /* * call-seq: * sym.to_i => fixnum - * sym.to_int => fixnum * * Returns an integer that is unique for each symbol within a * particular execution of a program. @@ -1137,6 +1136,17 @@ sym_to_i(sym) } +/* :nodoc: */ + +static VALUE +sym_to_int(sym) + VALUE sym; +{ + rb_warning("treating Symbol as an integer"); + return sym_to_i(sym); +} + + /* * call-seq: * sym.inspect => string @@ -2604,7 +2614,7 @@ Init_Object() rb_undef_method(CLASS_OF(rb_cSymbol), "new"); rb_define_method(rb_cSymbol, "to_i", sym_to_i, 0); - rb_define_method(rb_cSymbol, "to_int", sym_to_i, 0); + rb_define_method(rb_cSymbol, "to_int", sym_to_int, 0); rb_define_method(rb_cSymbol, "inspect", sym_inspect, 0); rb_define_method(rb_cSymbol, "to_s", sym_to_s, 0); rb_define_method(rb_cSymbol, "id2name", sym_to_s, 0); -- cgit