zsh-workers
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh workers <zsh-workers@zsh.org>
Subject: Re: dead code in subst_parse_str
Date: Mon, 05 Jan 2015 21:25:21 -0800	[thread overview]
Message-ID: <150105212521.ZM10544@torch.brasslantern.com> (raw)
In-Reply-To: <CAHYJk3QMSktFEHetX-nSgt5Ae=L0eHRHQKqrhHiNz7i6g-tNYg@mail.gmail.com>

On Jan 6,  1:55am, Mikael Magnusson wrote:
}
} If you look carefully (or at coverity), you'll notice that qt is set
} to 0 initially, and then only toggled to 1 if it is already 1, ie
} never. This is again a case of I have no idea what's happening here,
} so I'll let you guys look at it.

Hmm, looks like it should have been this:

diff --git a/Src/subst.c b/Src/subst.c
index 4100803..610d71e 100644
--- a/Src/subst.c
+++ b/Src/subst.c
@@ -1333,14 +1333,16 @@ subst_parse_str(char **sp, int single, int err)
 	if (!single) {
             int qt = 0;
 
-	    for (; *s; s++)
+	    for (; *s; s++) {
 		if (!qt) {
 		    if (*s == Qstring)
 			*s = String;
 		    else if (*s == Qtick)
 			*s = Tick;
-                } else if (*s == Dnull)
+                }
+		if (*s == Dnull)
                     qt = !qt;
+	    }
 	}
 	return 0;
     }


However, I have no idea in what circumstances that matters.  Obviously
it has been doing something indistinguishable from the right thing with
the dead code for a long time.

-- 
Barton E. Schaefer


      reply	other threads:[~2015-01-06  5:25 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-06  0:55 Mikael Magnusson
2015-01-06  5:25 ` Bart Schaefer [this message]

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=150105212521.ZM10544@torch.brasslantern.com \
    --to=schaefer@brasslantern.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).