From: Avi Kivity <avi@redhat.com>
To: Blue Swirl <blauwirbel@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>, qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 8/9] lsi53c895a: avoid a warning from clang analyzer
Date: Mon, 05 Sep 2011 08:35:24 +0300 [thread overview]
Message-ID: <4E645F9C.6060504@redhat.com> (raw)
In-Reply-To: <CAAu8pHuDV09PNXbLDx7Jb1=hwHtQwEdk92Z_Rf_pGe3A4w=pCw@mail.gmail.com>
On 09/04/2011 07:27 PM, Blue Swirl wrote:
> >> to be really necessary). So let's simply clear all queued
> >> commands for the current device: */
> >> - id = current_tag& 0x0000ff00;
> >> - QTAILQ_FOREACH_SAFE(p,&s->queue, next, p_next) {
> >> - if ((p->tag& 0x0000ff00) == id) {
> >> - scsi_req_cancel(p->req);
> >> + {
> >> + int id;
> >> +
> >> + id = current_tag& 0x0000ff00;
> >> + QTAILQ_FOREACH_SAFE(p,&s->queue, next, p_next) {
> >> + if ((p->tag& 0x0000ff00) == id) {
> >> + scsi_req_cancel(p->req);
> >> + }
> >> }
> >> }
> >>
> >
> > Why not keep id declared in the outer scope? This extra indentation is
> > annoying.
>
> Also the variable could be dropped altogether simply with:
> if ((p->tag& 0x0000ff00) == (current_tag& 0x0000ff00)) {
>
> I have no preference.
Yet another option is to allow intermixing declarations and statements
(which C99 allows), though it tends to get some traditionalists worked up.
It's particularly nice in for () loops.
--
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.
next prev parent reply other threads:[~2011-09-05 5:35 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-04 15:53 [Qemu-devel] [PATCH 8/9] lsi53c895a: avoid a warning from clang analyzer Blue Swirl
2011-09-04 16:20 ` Avi Kivity
2011-09-04 16:27 ` Blue Swirl
2011-09-05 5:35 ` Avi Kivity [this message]
2011-09-04 17:05 ` Peter Maydell
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=4E645F9C.6060504@redhat.com \
--to=avi@redhat.com \
--cc=blauwirbel@gmail.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.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.
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).