summaryrefslogtreecommitdiff
path: root/ext/gdbm
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-12-14 06:50:43 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-12-14 06:50:43 +0000
commit9d228b13deccfdf23f44e2c465f723a2a7b3bcbd (patch)
tree9a4d769804c389b6b03bbfdf65e8e0a03288c8e8 /ext/gdbm
parentc18d3740a925e8752c3b93acea6087fb0e03be53 (diff)
19991214
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@587 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/gdbm')
-rw-r--r--ext/gdbm/gdbm.c15
1 files changed, 4 insertions, 11 deletions
diff --git a/ext/gdbm/gdbm.c b/ext/gdbm/gdbm.c
index b38bb8e..116b19d 100644
--- a/ext/gdbm/gdbm.c
+++ b/ext/gdbm/gdbm.c
@@ -169,7 +169,7 @@ fgdbm_delete(obj, keystr)
if (gdbm_delete(dbm, key)) {
dbmp->di_size = -1;
- rb_raise(rb_eRuntimeError, "dbm_delete failed");
+ rb_raise(rb_eRuntimeError, "gdbm_delete failed");
}
else if (dbmp->di_size >= 0) {
dbmp->di_size--;
@@ -218,7 +218,7 @@ fgdbm_delete_if(obj)
valstr = rb_tainted_str_new(val.dptr, val.dsize);
if (RTEST(rb_yield(rb_assoc_new(keystr, valstr)))) {
if (gdbm_delete(dbm, key)) {
- rb_raise(rb_eRuntimeError, "dbm_delete failed");
+ rb_raise(rb_eRuntimeError, "gdbm_delete failed");
}
}
}
@@ -240,7 +240,7 @@ fgdbm_clear(obj)
for (key = gdbm_firstkey(dbm); key.dptr; key = nextkey) {
nextkey = gdbm_nextkey(dbm, key);
if (gdbm_delete(dbm, key)) {
- rb_raise(rb_eRuntimeError, "dbm_delete failed");
+ rb_raise(rb_eRuntimeError, "gdbm_delete failed");
}
}
return obj;
@@ -313,19 +313,12 @@ fgdbm_store(obj, keystr, valstr)
struct dbmdata *dbmp;
GDBM_FILE dbm;
- if (valstr == Qnil) {
- fgdbm_delete(obj, keystr);
- return Qnil;
- }
-
rb_secure(4);
keystr = rb_obj_as_string(keystr);
key.dptr = RSTRING(keystr)->ptr;
key.dsize = RSTRING(keystr)->len;
- if (NIL_P(valstr)) return fgdbm_delete(obj, keystr);
-
valstr = rb_obj_as_string(valstr);
val.dptr = RSTRING(valstr)->ptr;
val.dsize = RSTRING(valstr)->len;
@@ -335,7 +328,7 @@ fgdbm_store(obj, keystr, valstr)
dbm = dbmp->di_dbm;
if (gdbm_store(dbm, key, val, GDBM_REPLACE)) {
if (errno == EPERM) rb_sys_fail(0);
- rb_raise(rb_eRuntimeError, "dbm_store failed");
+ rb_raise(rb_eRuntimeError, "gdbm_store failed");
}
return valstr;