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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]