[SSSD] [PATCH] Cleanups

Simo Sorce ssorce at redhat.com
Sat Nov 7 18:22:11 UTC 2009


On Fri, 2009-11-06 at 21:37 -0500, Dmitri Pal wrote:
> Martin Nagy wrote:
> > Simo Sorce wrote:
> >   
> >> This patch adds some cleanups and fixes coding style deviations.
> >> There are some more in the resolve code.
> >>     
> >
> > You added braces to if constructs. I was under the impression that we
> > shouldn't use them for one line statements [1]. Personally, I find it
> > more readable without them, but if the general consensus is to use them
> > then someone should update the coding style. Same goes for one liners
> > like:
> >
> > +        if (err) return err;
> >
> >   
> We  said that it is Ok to use braces for one liners but forgot to update
> the style guide.
> I personally think that there is where few cases where the one liner
> should exist.
> For example in case above in 99.99% cases it should be:
> 
>      if (something) {
>          /* Comment on the occasion */
>          DEBUG(this_thingy)
>          free(whatever);
>          return right_thing;
>     }

Not when using talloc and debug is made in the caller.

> I took an action item to update style guide.

Thanks I think it is ok to not use braces on one liners, on things like
if (err) return err;
But imo only in these case.
Normally it should be recommended to use braces even for one liners
especially in if/else cases, makes stuff much more readable IMO.

Simo.

-- 
Simo Sorce * Red Hat, Inc * New York




More information about the sssd-devel mailing list