zsh-workers
 help / color / mirror / code / Atom feed
From: Wayne Davison <wayned@users.sourceforge.net>
To: Mikael Magnusson <mikachu@gmail.com>
Cc: zsh-workers@zsh.org
Subject: Re: PATCH: Remove some unused assignments/checks noticed by clang
Date: Sat, 14 May 2011 10:22:01 -0700	[thread overview]
Message-ID: <BANLkTikhjErrVENxkPix=AvrFq=-6ah06w@mail.gmail.com> (raw)
In-Reply-To: <1305332636-26241-1-git-send-email-mikachu@gmail.com>

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.

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.

..wayne..


  reply	other threads:[~2011-05-14 17:29 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 [this message]
2011-05-14 17:43   ` Mikael Magnusson
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='BANLkTikhjErrVENxkPix=AvrFq=-6ah06w@mail.gmail.com' \
    --to=wayned@users.sourceforge.net \
    --cc=mikachu@gmail.com \
    --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).