From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2431 invoked by alias); 20 Jul 2016 08:35:26 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 38893 Received: (qmail 27363 invoked from network); 20 Jul 2016 08:35:26 -0000 X-Qmail-Scanner-Diagnostics: from mailout3.w1.samsung.com by f.primenet.com.au (envelope-from , uid 7791) with qmail-scanner-2.11 (clamdscan: 0.99.2/21882. spamassassin: 3.4.1. Clear:RC:0(210.118.77.13):SA:0(-1.3/5.0):. Processed in 0.152009 secs); 20 Jul 2016 08:35:26 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=RP_MATCHES_RCVD autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: p.stephenson@samsung.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: none (ns1.primenet.com.au: domain at samsung.com does not designate permitted sender hosts) X-AuditID: cbfec7f4-f796c6d000001486-72-578f37c5c05c Date: Wed, 20 Jul 2016 09:35:15 +0100 From: Peter Stephenson To: zsh-workers@zsh.org Subject: Re: Incorrect sorting of Polish characters Message-id: <20160720093515.07cedcdc@pwslap01u.europe.root.pri> In-reply-to: <160719220508.ZM10438@torch.brasslantern.com> References: <160716130718.ZM4513@torch.brasslantern.com> <20160718103329.7acbb1b1@pwslap01u.europe.root.pri> <20160718111735.6adea125@pwslap01u.europe.root.pri> <160719220508.ZM10438@torch.brasslantern.com> Organization: Samsung Cambridge Solution Centre X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; i386-redhat-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrILMWRmVeSWpSXmKPExsVy+t/xa7pHzfvDDW6eFbE42PyQyYHRY9XB D0wBjFFcNimpOZllqUX6dglcGRfubGMp2M5d8WDhTaYGxgccXYycHBICJhKvOncxQ9hiEhfu rWfrYuTiEBJYyiixdtN+KGcGk8S5GXOYIZxzjBKtj6eyQzhnGSWO994CynBwsAioSkxclQ8y ik3AUGLqptmMILaIgLjE2bXnWUBsYQFjiaaXy8HW8QrYS5zb8wbM5hSwkthw4SMrxMy5TBIv T+4Aa+YX0Je4+vcTE8R99hIzr5xhhGgWlPgx+R7YUGYBLYnN25pYIWx5ic1r3oINFRJQl7hx dzf7BEbhWUhaZiFpmYWkZQEj8ypG0dTS5ILipPRcQ73ixNzi0rx0veT83E2MkID+soNx8TGr Q4wCHIxKPLwRB/vChVgTy4orcw8xSnAwK4nw5pn1hwvxpiRWVqUW5ccXleakFh9ilOZgURLn nbvrfYiQQHpiSWp2ampBahFMlomDU6qBsXjmO5eJm758v5//sTs0fPn1xQeMll3++eshu9zM qIikEuGPPJaenGwu1kpTnV/1ndsSa2Oqo2K87P6B85I1aacuZJhcPF+fcrZSZsvkiWzdO86v fvEswfPuwY+l07p+vDoYsejvPj8BVV2pczotVx35LX81/NzH9kPXlmHGpjlmHhMvv33+6K0S S3FGoqEWc1FxIgBFZHsCZAIAAA== On Tue, 19 Jul 2016 22:05:08 -0700 Bart Schaefer wrote: > On Jul 18, 11:17am, Peter Stephenson wrote: > } > } Adding an umetafied entry to the glob match that only gets used for > } sorting seems to do the trick. I think an additional single pass > } through the array of matches isn't a big deal. > > Hm. On a glob of 16794 files it's about 4% slower over 10 trials with > the extra pass over the array of matches. I don't suppose there's some > way to store the original file name at the time metafication is applied > rather than metafying and then unmetafying again? It already works like that, and it only copies and unmetafies if there's a Meta character. It might be possible to squeeze this code somewhere else at the expense of clarity and likelihood of bugs. There are about four places where the name is set which could be turned into a function. Daniel pointed out strchr() would be neater. pws diff --git a/Src/glob.c b/Src/glob.c index 146b4db..850405f 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -1922,13 +1922,7 @@ zglob(LinkList list, LinkNode np, int nountok) */ for (gmptr = matchbuf; gmptr < matchptr; gmptr++) { - char *nptr; - for (nptr = gmptr->name; *nptr; nptr++) - { - if (*nptr == Meta) - break; - } - if (*nptr == Meta) + if (strchr(gmptr->name, Meta)) { int dummy; gmptr->uname = dupstring(gmptr->name);