From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3718 invoked by alias); 14 May 2011 17:29:31 -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: 29283 Received: (qmail 17496 invoked from network); 14 May 2011 17:29:29 -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.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 74.125.83.171 as permitted sender) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=S9Wh4MQbTFLnm3a/2zcVXntyHuHkKpGTJci3I63PtuQ=; b=HnOT6XvryPER1oAlfw2Dnd1+o0avFKyYWAQ0v7U0eIK1IkC9rfOJZ9mRKAaJzCPxJa CL42OkBycnALxHFv1ObPpMNz0JZUXWu0aTxXzbE5VThIUjrXMrte8BAr7YEd/sjsjJSi QGw1bUMOEQMbW0gK32nCUaquVjhQWrlzLyHXk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=T70/YYwmUJDt+XgjB+punpKTT2ITd31OErtzLJwh4pwV42pJcovOJDdBZqdMfeYNrb xoD+9f59fAitG5cwNx8ZbDpokM8O2I9SgXpD3tvewxfZeNluFiUU0pwFRUezhBtUJygu o/z2I5XlQKb87CLOwWUkInnsjxnAYvXYOHW6c= MIME-Version: 1.0 Sender: 4wayned@gmail.com In-Reply-To: <1305332636-26241-1-git-send-email-mikachu@gmail.com> References: <1305332636-26241-1-git-send-email-mikachu@gmail.com> Date: Sat, 14 May 2011 10:22:01 -0700 X-Google-Sender-Auth: tDYuZmnalT6yIRcjn57MH2dgYgU Message-ID: Subject: Re: PATCH: Remove some unused assignments/checks noticed by clang From: Wayne Davison To: Mikael Magnusson Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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) > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (*b =3D=3D '#' || *b =3D=3D Pound || *b =3D= =3D '+') > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0b++; > > - =C2=A0 =C2=A0 =C2=A0 e =3D b; > =C2=A0 =C2=A0 =C2=A0 =C2=A0if (br) { > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0while (*e =3D=3D (test ? Dnull := '"')) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0e++, parq++; That change looks wrong to me. You should remove the " =3D b" initializer in the declaration: char *b =3D p + 1, *e =3D b, *ie; The later assignment could occur after b changes value, and thus removing it means that e starts further back in the string. 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) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0q =3D dupstring(q); > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0t =3D q + strlen(q) - 1; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (*t =3D=3D ')') { > - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (s =3D t--; t > q;= t--) > + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 while (--t) > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (= *t =3D=3D ')' || *t =3D=3D '|' || *t =3D=3D '~' || *t =3D=3D '(') > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0break; > =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (t !=3D q && *t= =3D=3D '(') That while should be while (--t > q), since indexing a string back to 0 is not a good idea. ..wayne..