[haiku-commits] Re: r40809 - haiku/trunk/src/kits/tracker

  • From: "Jonas Sundström" <jonas@xxxxxxxxxxx>
  • To: "haiku-commits@xxxxxxxxxxxxx" <haiku-commits@xxxxxxxxxxxxx>
  • Date: Sat, 05 Mar 2011 00:37:11 +0100

Ingo Weinhold <ingo_weinhold@xxxxxx> wrote:
> On 2011-03-04 at 19:42:48 [+0100], jonas@xxxxxxxxxxx wrote:
> > Author: kirilla
> > Date: 2011-03-04 19:42:48 +0100 (Fri, 04 Mar 2011)
> > New Revision: 40809
> > Changeset: http://dev.haiku-os.org/changeset/40809
 ...
> > -    if (context) {
> > +    if (context != NULL) {
> >          context[0] = '\0';
> >          context++;
> >      } else
> >          return B_ENTRY_NOT_FOUND;
> 
> At the risk of being annoying: For sake of better readability
> I'd recommend the "immediate bail out on error" style, i.e. check
> for error (rather than success) and return an error immediately.
> So the main control flow can continue on the topmost level.
> 
>       if (context == NULL)
>               return B_ENTRY_NOT_FOUND;
> 
>       context[0] = '\0';
>       context++;
>       ...

I see what you mean. Will do it tomorrow.

/Jonas.


Other related posts: