zsh-workers
 help / color / mirror / code / Atom feed
From: Sebastian Gniazdowski <psprint2@fastmail.com>
To: zsh-workers@zsh.org
Subject: Re: [PATCH] db/gdbm rewrite
Date: Thu, 16 Feb 2017 10:16:02 -0800	[thread overview]
Message-ID: <1487268962.1940670.883365040.78AEB334@webmail.messagingengine.com> (raw)
In-Reply-To: <1487261017.1907093.883202288.270632CF@webmail.messagingengine.com>

[-- Attachment #1: Type: text/plain, Size: 200 bytes --]

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@fastmail.com

[-- Attachment #2: db_gdbm_rewrite4_plus.diff --]
[-- Type: text/plain, Size: 1271 bytes --]

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}*

  parent reply	other threads:[~2017-02-16 18:16 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-14 12:20 Sebastian Gniazdowski
2017-02-15 10:22 ` Sebastian Gniazdowski
2017-02-16 10:16   ` Peter Stephenson
2017-02-16 11:46     ` Sebastian Gniazdowski
2017-02-16 12:52       ` Peter Stephenson
2017-02-16 14:25         ` Sebastian Gniazdowski
2017-02-16 14:30           ` Sebastian Gniazdowski
2017-02-16 15:11             ` Peter Stephenson
2017-02-16 16:03               ` Sebastian Gniazdowski
2017-02-16 16:25                 ` Sebastian Gniazdowski
2017-02-16 16:36                   ` Peter Stephenson
2017-02-16 17:12                     ` Sebastian Gniazdowski
2017-02-16 18:16                 ` Sebastian Gniazdowski [this message]
2017-02-19  0:43 (Fwd) " Bart Schaefer
2017-02-19  8:46 ` Sebastian Gniazdowski
2017-02-19 18:19   ` Bart Schaefer
2017-02-20  8:32     ` Sebastian Gniazdowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1487268962.1940670.883365040.78AEB334@webmail.messagingengine.com \
    --to=psprint2@fastmail.com \
    --cc=zsh-workers@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).