From: Mikael Magnusson <mikachu@gmail.com>
To: Wayne Davison <wayned@users.sourceforge.net>
Cc: zsh-workers@zsh.org
Subject: Re: PATCH: Remove some unused assignments/checks noticed by clang
Date: Sat, 14 May 2011 19:43:27 +0200 [thread overview]
Message-ID: <BANLkTimpSyRX=hzL=hbXxC+hFvqnUo2x2Q@mail.gmail.com> (raw)
In-Reply-To: <BANLkTikhjErrVENxkPix=AvrFq=-6ah06w@mail.gmail.com>
On 14 May 2011 19:22, Wayne Davison <wayned@users.sourceforge.net> wrote:
> On Fri, May 13, 2011 at 5:23 PM, Mikael Magnusson <mikachu@gmail.com> 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
next prev parent reply other threads:[~2011-05-14 17:43 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-14 0:23 Mikael Magnusson
2011-05-14 17:22 ` Wayne Davison
2011-05-14 17:43 ` Mikael Magnusson [this message]
2011-05-14 19:25 ` Bart Schaefer
2011-05-14 17:52 ` Mikael Magnusson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='BANLkTimpSyRX=hzL=hbXxC+hFvqnUo2x2Q@mail.gmail.com' \
--to=mikachu@gmail.com \
--cc=wayned@users.sourceforge.net \
--cc=zsh-workers@zsh.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).