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

Re: [PATCH] db/gdbm rewrite



Hello,
missed one metafication (in hash scan function), added test for that,
and also for zgdbmpath builtin. Incremental to db_gdbm_rewrite4.diff.

-- 
  Sebastian Gniazdowski
  psprint2@xxxxxxxxxxxx
diff --git a/Src/Modules/db_gdbm.c b/Src/Modules/db_gdbm.c
index 8a61b2f..596a8ae 100644
--- a/Src/Modules/db_gdbm.c
+++ b/Src/Modules/db_gdbm.c
@@ -442,7 +442,7 @@ scangdbmkeys(HashTable ht, ScanFunc func, int flags)
         /* This returns database-interfacing Param,
          * it will return u.str or first fetch data
          * if not PM_UPTODATE (newly created) */
-        char *zkey = ztrduppfx(key.dptr, key.dsize);
+        char *zkey = metafy(key.dptr, key.dsize, META_DUP);
         HashNode hn = getgdbmnode(ht, zkey);
         zsfree( zkey );
 
diff --git a/Test/V11db_gdbm.ztst b/Test/V11db_gdbm.ztst
index a1076dc..486ad48 100644
--- a/Test/V11db_gdbm.ztst
+++ b/Test/V11db_gdbm.ztst
@@ -280,6 +280,28 @@
 >漢�
 >correct
 
+ ztie -d db/gdbm -f $dbfile dbase
+ dbase=( 漢� 漢� )
+ zuntie dbase
+ ztie -d db/gdbm -f $dbfile dbase
+ noglob print -rl ${(kv)dbase[@]}
+ zuntie dbase
+0:Hash scanning and metafication
+>漢�
+>漢�
+
+ ztie -d db/gdbm -f $dbfile dbase
+ zgdbmpath dbase
+ [[ $REPLY = */Test/db.gdbm ]] && echo correct
+ zuntie dbase
+ ztie -r -d db/gdbm -f $dbfile dbase
+ zgdbmpath dbase
+ [[ $REPLY = */Test/db.gdbm ]] && echo correct
+ zuntie -u dbase
+0:zgdbmpath builtin
+>correct
+>correct
+
 %clean
 
   rm -f ${dbfile}*


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