Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH Re: Issue with histreduceblanks
- X-seq: zsh-workers 31770
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH Re: Issue with histreduceblanks
- Date: Thu, 26 Sep 2013 20:19:03 -0700
- Cc: Raghavendra Prabhu <raghu.prabhu13@xxxxxxxxx>
- In-reply-to: <CAH+w=7bFh9ULURuAruCHUihSvKnFRxHw662+ONz0dAVs_qP4kA@mail.gmail.com>
- List-help: <mailto:zsh-workers-help@zsh.org>
- List-id: Zsh Workers List <zsh-workers.zsh.org>
- List-post: <mailto:zsh-workers@zsh.org>
- Mailing-list: contact zsh-workers-help@xxxxxxx; run by ezmlm
- References: <20130918185058.GA19235@Archie> <20130918211227.51cdbd0f@pws-pc.ntlworld.com> <CAEtq3tNjNumBv2BZMS0FXUL9-pRWDtGZJ1pZ1NKPw3rxtOFunA@mail.gmail.com> <130926101254.ZM23201@torch.brasslantern.com> <CAEtq3tPwqqFaxMHuCkjgoq8diRyFrT9ZAyy+p1sHZBDqteTc9A@mail.gmail.com> <CAH+w=7bFh9ULURuAruCHUihSvKnFRxHw662+ONz0dAVs_qP4kA@mail.gmail.com>
On Sep 26, 2:03pm, Bart Schaefer wrote:
}
} might be a compiler optimization issue; in any case I think memcpy() is not
} guaranteed to work with overlapping regions and histreduceblanks() ought to
} be using memmove() instead. I seem to recall us having to fix this in a
} different part of the shell some while ago.
diff --git a/Src/hist.c b/Src/hist.c
index f78c97d..3d6068e 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -953,7 +953,7 @@ histreduceblanks(void)
len = chwords[i+1] - chwords[i];
needblank = (i < chwordpos-2 && chwords[i+2] > chwords[i+1]);
if (pos != chwords[i]) {
- memcpy(chline + pos, chline + chwords[i], len + needblank);
+ memmove(chline + pos, chline + chwords[i], len + needblank);
chwords[i] = pos;
chwords[i+1] = chwords[i] + len;
}
Messages sorted by:
Reverse Date,
Date,
Thread,
Author