Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: unset/delete gdbm elements



ztie -d db/gdbm -f /tmp/newfile.db hokeypokey
hokeypokey[horse]=buggy
hokeypokey[apple]=pie
print -l -- ${hokeypokey}
print ${hokeypokey[horse]}
print ${hokeypokey[apple]}
unset "hokeypokey[apple]"

diff --git a/Src/Modules/db_gdbm.c b/Src/Modules/db_gdbm.c
index d8f6724..ce7a6f5 100644
--- a/Src/Modules/db_gdbm.c
+++ b/Src/Modules/db_gdbm.c
@@ -132,7 +132,6 @@ gdbmsetfn(Param pm, char **val)
     datum key, content;
     int ret;
 
-
     key.dptr = pm->node.nam;
     key.dsize = strlen(key.dptr) + 1;
     content.dptr = val;
@@ -145,7 +144,13 @@ gdbmsetfn(Param pm, char **val)
 static void
 gdbmunsetfn(Param pm, int um)
 {
+    datum key;
+    int ret;
+
+    key.dptr = pm->node.nam;
+    key.dsize = strlen(key.dptr) + 1;
 
+    ret = gdbm_delete(dbf, key);
 }
 
 /**/



Messages sorted by: Reverse Date, Date, Thread, Author