Re: [PATCH 1b/7] dlm: core locking

From: Daniel Phillips
Date: Tue Apr 26 2005 - 00:03:08 EST


On Monday 25 April 2005 16:41, Jesper Juhl wrote:
> > +     }
> > +
> > +     if (!lkb->lkb_lvbptr)
> > +             return;
>
> goto out;
>
> > +
> > +     if (!(lkb->lkb_exflags & DLM_LKF_VALBLK))
> > +             return;
>
> goto out;
>
> > +
> > +     if (!r->res_lvbptr)
> > +             r->res_lvbptr = allocate_lvb(r->res_ls);
> > +
> > +     memcpy(r->res_lvbptr, lkb->lkb_lvbptr, DLM_LVB_LEN);
> > +     r->res_lvbseq++;
> > +     clear_bit(RESFL_VALNOTVALID, &r->res_flags);
>
> out:
>         return;
>
> > +}
>
> A single return function exit point instead of multiple reduces the risk
> of errors when code is later modified.
> Applies to many other functions besides this one (and this one may not
> even be the best example, but hey, I wanted to make that comment, and
> this function was at hand).

Great comments on the whole, but this one is really well into the "matter of
taste" zone. Naked return vs goto return... either way is ugly. I prefer
the style that is two lines shorter and does not make my eyes do an extra
hop.

Regards,

Daniel
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/