Sure thing. The table initialization in this case is redundant. On 8/28/06, nobu / ruby-lang.org <nobu / ruby-lang.org> wrote: > Hi, > > At Tue, 29 Aug 2006 09:15:27 +0900, > Kent Sibilev wrote in [ruby-talk:211236]: > > Interesting. Does this patch fixes it? > > Yes, and modified it slightly. > > > Index: hash.c > =================================================================== > RCS file: /cvs/ruby/src/ruby/hash.c,v > > retrieving revision 1.128.2.16 > diff -p -U 2 -r1.128.2.16 hash.c > --- hash.c 6 Jul 2006 15:44:26 -0000 1.128.2.16 > +++ hash.c 29 Aug 2006 03:43:58 -0000 > @@ -224,7 +224,8 @@ rb_hash_foreach(hash, func, farg) > } > > +static VALUE hash_alloc0 _((VALUE)); > static VALUE hash_alloc _((VALUE)); > static VALUE > -hash_alloc(klass) > +hash_alloc0(klass) > VALUE klass; > { > @@ -233,9 +234,19 @@ hash_alloc(klass) > > hash->ifnone = Qnil; > - hash->tbl = st_init_table(&objhash); > > return (VALUE)hash; > } > > +static VALUE > +hash_alloc(klass) > + VALUE klass; > +{ > + VALUE hash = hash_alloc0(klass); > + > + RHASH(hash)->tbl = st_init_table(&objhash); > + > + return hash; > +} > + > VALUE > rb_hash_new() > @@ -326,7 +337,5 @@ rb_hash_s_create(argc, argv, klass) > > if (argc == 1 && TYPE(argv[0]) == T_HASH) { > - hash = hash_alloc(klass); > - > - RHASH(hash)->ifnone = Qnil; > + hash = hash_alloc0(klass); > RHASH(hash)->tbl = st_copy(RHASH(argv[0])->tbl); > > > > -- > Nobu Nakada > > -- Kent --- http://www.datanoise.com