Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: PATCH: Remove some unused assignments/checks noticed by clang
- X-seq: zsh-workers 29284
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx>
- Subject: Re: PATCH: Remove some unused assignments/checks noticed by clang
- Date: Sat, 14 May 2011 19:43:27 +0200
- Cc: zsh-workers@xxxxxxx
- 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=
- In-reply-to: <BANLkTikhjErrVENxkPix=AvrFq=-6ah06w@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: <1305332636-26241-1-git-send-email-mikachu@gmail.com> <BANLkTikhjErrVENxkPix=AvrFq=-6ah06w@mail.gmail.com>
On 14 May 2011 19:22, Wayne Davison <wayned@xxxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, May 13, 2011 at 5:23 PM, Mikael Magnusson <mikachu@xxxxxxxxx> 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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author