From: "Nikolai Weibull" <now@bitwi.se>
To: "Zsh hackers list" <zsh-workers@sunsite.dk>
Subject: [Patch] Bug in strmetasort()
Date: Sun, 13 May 2007 21:58:26 +0200 [thread overview]
Message-ID: <dbfc82860705131258r4d3a2aacqb01974e286588ffc@mail.gmail.com> (raw)
The old test for determining when s has reached the end of src was
bugged. I don't quite see how this hasn't happened earlier, but I
managed to catch it when running history-beginning-search-menu on an
empty buffer.
The solution is simple, store the end before starting the loop and
then just verify that s stays below that end for the duration of the
loop. This will be faster too, so it's a win-win-win situation.
nikolai
Index: sort.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/sort.c,v
retrieving revision 1.5
diff -u -r1.5 sort.c
--- sort.c 16 Apr 2007 13:21:26 -0000 1.5
+++ sort.c 13 May 2007 19:56:22 -0000
@@ -338,8 +338,9 @@
src = dst;
}
if (sortwhat & SORTIT_IGNORING_BACKSLASHES) {
+ char *end = src + len + 1;
/* copy null byte, so increment length */
- for (s = src, t = dst; s - src != len+1; ) {
+ for (s = src, t = dst; s < end; ) {
if (*s == '\\') {
s++;
len--;
reply other threads:[~2007-05-13 19:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=dbfc82860705131258r4d3a2aacqb01974e286588ffc@mail.gmail.com \
--to=now@bitwi.se \
--cc=zsh-workers@sunsite.dk \
/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).