summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-20 08:33:17 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-20 08:33:17 +0000
commitbc49bc7c6b6a16d725cd1279e9021465b1307f3d (patch)
tree023b7da77738e7e049de5002eade542b7f17e930 /hash.c
parentb702ab5d6cf585ac0ff0cad3cd5aebbc40e82de0 (diff)
downloadruby-bc49bc7c6b6a16d725cd1279e9021465b1307f3d.tar.gz
* parse.y (do_block): split "do" block and tLBRACE_ARG block.
* parse.y (cmd_brace_block): new tLBRACE_ARG block rule * parse.y (command): can take optional cmd_brace_block; use %prec to resolve shift/reduce conflict. (ruby-bugs-ja PR#372) * eval.c (ruby_finalize): trace_func should be cleared here (after executing exit procs and finalizers). * eval.c (rb_define_alloc_func): new allocation framework, based on Nobu's work [ruby-dev:19116]. "allocate" method is no longer used for object allocation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/hash.c b/hash.c
index 245ba53e5a..16b89bfacd 100644
--- a/hash.c
+++ b/hash.c
@@ -179,7 +179,7 @@ rb_hash_foreach(hash, func, farg)
}
static VALUE
-rb_hash_s_alloc(klass)
+hash_alloc(klass)
VALUE klass;
{
NEWOBJ(hash, struct RHash);
@@ -194,7 +194,7 @@ rb_hash_s_alloc(klass)
VALUE
rb_hash_new()
{
- return rb_hash_s_alloc(rb_cHash);
+ return hash_alloc(rb_cHash);
}
static VALUE
@@ -231,7 +231,7 @@ rb_hash_s_create(argc, argv, klass)
int i;
if (argc == 1 && TYPE(argv[0]) == T_HASH) {
- hash = rb_obj_alloc(klass);
+ hash = hash_alloc(klass);
RHASH(hash)->ifnone = Qnil;
RHASH(hash)->tbl = st_copy(RHASH(argv[0])->tbl);
@@ -243,7 +243,7 @@ rb_hash_s_create(argc, argv, klass)
rb_raise(rb_eArgError, "odd number args for Hash");
}
- hash = rb_obj_alloc(klass);
+ hash = hash_alloc(klass);
for (i=0; i<argc; i+=2) {
rb_hash_aset(hash, argv[i], argv[i + 1]);
}
@@ -1595,7 +1595,7 @@ Init_Hash()
rb_include_module(rb_cHash, rb_mEnumerable);
- rb_define_singleton_method(rb_cHash, "allocate", rb_hash_s_alloc, 0);
+ rb_define_alloc_func(rb_cHash, hash_alloc);
rb_define_singleton_method(rb_cHash, "[]", rb_hash_s_create, -1);
rb_define_method(rb_cHash,"initialize", rb_hash_initialize, -1);