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

Daniel Phillips
2005-04-26T05:00:57Z

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