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.


Reply via email to