From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10412 invoked by alias); 14 May 2011 17:43:35 -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: 29284 Received: (qmail 15660 invoked from network); 14 May 2011 17:43:34 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.212.43 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=9ldhmAsQMrUfzqfQNQX14DxYTwtFTsh9aIMg3lfFaMo=; b=ro25NBC1wChM03woh76pFFup+Vmy7z4yQgrQEQ3b05h9U/SSsoUquzQr+dEe7QfSMv ldmlbnYGszTjm69zGHdwbuKBJIDPi+UfzFzepjSSj1YneX0eUBpWJm3Zknuq9yPsNrQa I0GxWk9HgYU5Jjvh2JktzXws4c6DOKqxoI0wg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; b=rd8ErV8f/2AfR9TF7BJN1O7oQO51qDnZakyGwUA7hJgrXM/MPXeDnpepuMeLTapxdM m8d2kFXsJsR7Q1Gtx9TK3JTbMParYjaC2T7ZUgfMBpgzJ0r24//HYRCsV1vz895axAd5 piwKDvM4BibKfTfFMC3XmCdvV1Wv9VhfMM6vM= MIME-Version: 1.0 In-Reply-To: References: <1305332636-26241-1-git-send-email-mikachu@gmail.com> Date: Sat, 14 May 2011 19:43:27 +0200 Message-ID: Subject: Re: PATCH: Remove some unused assignments/checks noticed by clang From: Mikael Magnusson To: Wayne Davison Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 On 14 May 2011 19:22, Wayne Davison wrote: > On Fri, May 13, 2011 at 5:23 PM, Mikael Magnusson wrote: >> --- a/Src/Zle/compcore.c >> +++ b/Src/Zle/compcore.c >> @@ -1162,7 +1162,6 @@ check_param(char *s, int set, int test) >> if (*b == '#' || *b == Pound || *b == '+') >> b++; >> >> - e = b; >> if (br) { >> while (*e == (test ? Dnull : '"')) >> e++, parq++; > > That change looks wrong to me. You should remove the " = b" > initializer in the declaration: > > char *b = p + 1, *e = b, *ie; > > The later assignment could occur after b changes value, and thus > removing it means that e starts further back in the string. Oops, but also weird. With the change, the md5sum of Src/zsh remains the same, but Src/Zle/compcore..o changes. > The same comment applies to the similar change in zle_tricky.c. > >> --- a/Src/Zle/computil.c >> +++ b/Src/Zle/computil.c >> @@ -4465,7 +4465,7 @@ cfp_opt_pats(char **pats, char *matcher) >> q = dupstring(q); >> t = q + strlen(q) - 1; >> if (*t == ')') { >> - for (s = t--; t > q; t--) >> + while (--t) >> if (*t == ')' || *t == '|' || *t == '~' || *t == '(') >> break; >> if (t != q && *t == '(') > > That while should be while (--t > q), since indexing a string back to > 0 is not a good idea. Indeed. I'd better look at the whole patch once more. :) -- Mikael Magnusson