Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: dead code in subst_parse_str
- X-seq: zsh-workers 34103
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh workers <zsh-workers@xxxxxxx>
- Subject: Re: dead code in subst_parse_str
- Date: Mon, 05 Jan 2015 21:25:21 -0800
- In-reply-to: <CAHYJk3QMSktFEHetX-nSgt5Ae=L0eHRHQKqrhHiNz7i6g-tNYg@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: <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
Messages sorted by:
Reverse Date,
Date,
Thread,
Author