Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: [PATCH] enable number argument for transpose-words
- X-seq: zsh-workers 39031
- From: Peter Stephenson <p.stephenson@xxxxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: Re: [PATCH] enable number argument for transpose-words
- Date: Fri, 12 Aug 2016 11:41:42 +0100
- In-reply-to: <1516997.6itNjt3W91@kdudka-nb>
- 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
- Organization: Samsung Cambridge Solution Centre
- References: <20160801103212.GA24067@localhost.localdomain> <20160812025402.GA5319@localhost.localdomain> <20160812102918.5ad0f649@pwslap01u.europe.root.pri> <1516997.6itNjt3W91@kdudka-nb>
On Fri, 12 Aug 2016 12:25:55 +0200
Kamil Dudka <kdudka@xxxxxxxxxx> wrote:
> Is the body of 'while (n--)' loop guaranteed to be executed at least once?
>
> Otherwise p1 and p2 may be used uninitialized by code following after the
> loop.
It's probably reasonable to do the following...
pws
diff --git a/Src/Zle/zle_word.c b/Src/Zle/zle_word.c
index 2a15171..e4a878e 100644
--- a/Src/Zle/zle_word.c
+++ b/Src/Zle/zle_word.c
@@ -722,7 +722,7 @@ transposewords(UNUSED(char **args))
if (!p3)
return 1;
- pt = p3;
+ p1 = p2 = pt = p3;
while (n--) {
for (p2 = pt; p2; ) {
Messages sorted by:
Reverse Date,
Date,
Thread,
Author