summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-01 03:12:21 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-02-01 03:12:21 +0000
commite4b53b22228d935847b72e8f9ab0f49a15b54215 (patch)
treeae6cd78921bf626d54145b5485474bf59c3dceb4 /hash.c
parent005f12582975d8382851b740690f97dba35aaa2a (diff)
2000-02-01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@611 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c29
1 files changed, 2 insertions, 27 deletions
diff --git a/hash.c b/hash.c
index b6a1d50..77f7e3e 100644
--- a/hash.c
+++ b/hash.c
@@ -23,39 +23,17 @@ char *strchr _((char*,char));
char* strdup(const char*);
#endif
-#define HASH_FREEZE FL_USER1
-#define HASH_DELETED FL_USER2
+#define HASH_DELETED FL_USER1
static void
rb_hash_modify(hash)
VALUE hash;
{
- if (FL_TEST(hash, HASH_FREEZE))
- rb_raise(rb_eTypeError, "can't modify frozen hash");
+ if (OBJ_FROZEN(hash)) rb_error_frozen("hash");
if (!OBJ_TAINTED(hash) && rb_safe_level() >= 4)
rb_raise(rb_eSecurityError, "Insecure: can't modify hash");
}
-VALUE
-rb_hash_freeze(hash)
- VALUE hash;
-{
- if (rb_safe_level() >= 4 && !OBJ_TAINTED(hash))
- rb_raise(rb_eSecurityError, "Insecure: can't freeze hash");
-
- FL_SET(hash, HASH_FREEZE);
- return hash;
-}
-
-static VALUE
-rb_hash_frozen_p(hash)
- VALUE hash;
-{
- if (FL_TEST(hash, HASH_FREEZE))
- return Qtrue;
- return Qfalse;
-}
-
VALUE rb_cHash;
static VALUE envtbl;
@@ -1387,9 +1365,6 @@ Init_Hash()
rb_define_method(rb_cHash,"dup", rb_hash_dup, 0);
rb_define_method(rb_cHash,"rehash", rb_hash_rehash, 0);
- rb_define_method(rb_cHash,"freeze", rb_hash_freeze, 0);
- rb_define_method(rb_cHash,"frozen?",rb_hash_frozen_p, 0);
-
rb_define_method(rb_cHash,"to_hash", rb_hash_to_hash, 0);
rb_define_method(rb_cHash,"to_a", rb_hash_to_a, 0);
rb_define_method(rb_cHash,"to_s", rb_hash_to_s, 0);