diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-07 08:44:24 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-05-07 08:44:24 +0000 |
commit | d4301da342a50aa72cd930208d0dfc516f76eaff (patch) | |
tree | 47b47a035bcad5c857f1d90b41e9c14bf2e9bbf8 /ext/dbm/dbm.c | |
parent | 6755eb4c0ac4fd31d8d69acfd50e0bf11179aa8e (diff) | |
download | ruby-d4301da342a50aa72cd930208d0dfc516f76eaff.tar.gz ruby-d4301da342a50aa72cd930208d0dfc516f76eaff.tar.xz ruby-d4301da342a50aa72cd930208d0dfc516f76eaff.zip |
* parse.y (string_content): turn off NODE_NEWLINE flag to avoid
unnecessary line trace for inlined expression.
(ruby-bugs PR#1320)
* numeric.c (flo_to_s): tweak output string based to preserve
decimal point and to remove trailing zeros. [ruby-talk:97891]
* string.c (rb_str_index_m): use unsigned comparison for T_FIXNUM
search. [ruby-talk:97342]
* hash.c (rb_hash_equal): returns true if two hashes have same set
of key-value set. [ruby-talk:97559]
* hash.c (rb_hash_eql): returns true if two hashes are equal and
have same default values.
* string.c (rb_str_equal): always returns true or false, never
returns nil. [ruby-dev:23404]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@6262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dbm/dbm.c')
-rw-r--r-- | ext/dbm/dbm.c | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/ext/dbm/dbm.c b/ext/dbm/dbm.c index c42239440..1e4fe00fe 100644 --- a/ext/dbm/dbm.c +++ b/ext/dbm/dbm.c @@ -280,6 +280,16 @@ fdbm_values_at(argc, argv, obj) return new; } +static void +fdbm_modify(obj) + VALUE obj; +{ + rb_secure(4); + if (OBJ_FROZEN_P(obj)) { + if (OBJ_FROZEN(obj)) rb_error_frozen("DBM"); + } +} + static VALUE fdbm_delete(obj, keystr) VALUE obj, keystr; @@ -289,7 +299,7 @@ fdbm_delete(obj, keystr) DBM *dbm; VALUE valstr; - rb_secure(4); + fdbm_modify(obj); StringValue(keystr); key.dptr = RSTRING(keystr)->ptr; key.dsize = RSTRING(keystr)->len; @@ -325,7 +335,7 @@ fdbm_shift(obj) DBM *dbm; VALUE keystr, valstr; - rb_secure(4); + fdbm_modify(obj); GetDBM(obj, dbmp); dbm = dbmp->di_dbm; dbmp->di_size = -1; @@ -351,7 +361,7 @@ fdbm_delete_if(obj) VALUE ret, ary = rb_ary_new(); int i, status = 0, n; - rb_secure(4); + fdbm_modify(obj); GetDBM(obj, dbmp); dbm = dbmp->di_dbm; n = dbmp->di_size; @@ -388,7 +398,7 @@ fdbm_clear(obj) struct dbmdata *dbmp; DBM *dbm; - rb_secure(4); + fdbm_modify(obj); GetDBM(obj, dbmp); dbm = dbmp->di_dbm; dbmp->di_size = -1; @@ -471,7 +481,7 @@ fdbm_store(obj, keystr, valstr) struct dbmdata *dbmp; DBM *dbm; - rb_secure(4); + fdbm_modify(obj); keystr = rb_obj_as_string(keystr); key.dptr = RSTRING(keystr)->ptr; |