From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26115 invoked by alias); 12 Aug 2016 13:10:06 -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: 39033 Received: (qmail 24649 invoked from network); 12 Aug 2016 13:10:06 -0000 X-Qmail-Scanner-Diagnostics: from mx1.redhat.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(209.132.183.28):SA:0(-0.5/5.0):. Processed in 0.119628 secs); 12 Aug 2016 13:10:06 -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=-0.5 required=5.0 tests=RP_MATCHES_RCVD,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.1 X-Envelope-From: kdudka@redhat.com X-Qmail-Scanner-Mime-Attachments: | X-Qmail-Scanner-Zip-Files: | Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf1.redhat.com designates 209.132.183.28 as permitted sender) From: Kamil Dudka To: Peter Stephenson Cc: zsh-workers@zsh.org Subject: Re: [PATCH] enable number argument for transpose-words Date: Fri, 12 Aug 2016 15:10:02 +0200 Message-ID: <1731715.OYnJ1QsI4R@kdudka-nb> User-Agent: KMail/4.14.10 (Linux/4.7.0-gentoo; KDE/4.14.20; x86_64; ; ) In-Reply-To: <20160812114142.79587341@pwslap01u.europe.root.pri> References: <20160801103212.GA24067@localhost.localdomain> <1516997.6itNjt3W91@kdudka-nb> <20160812114142.79587341@pwslap01u.europe.root.pri> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Fri, 12 Aug 2016 13:10:01 +0000 (UTC) On Friday, August 12, 2016 11:41:42 Peter Stephenson wrote: > On Fri, 12 Aug 2016 12:25:55 +0200 > > Kamil Dudka 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; ) { Appears fixed. Thanks! Kamil