[PATCHSET] Introduce SDB - a KDC backend abstraction

Andreas Schneider asn at samba.org
Thu Jul 30 08:38:47 UTC 2015


On Wednesday 29 July 2015 14:18:44 Jeremy Allison wrote:
> On Wed, Jul 29, 2015 at 01:36:43PM +0200, Andreas Schneider wrote:
> > Hello,
> > 
> > attached is a patchset which brings us again a step forward. It introduces
> > SDB a KDC backend abstraction. It implements a sdb to hdb translation
> > layer.
> > 
> > I've gone through the patches with Alexander and we cleaned up the
> > interface yesterday. It passes a full 'make test' on my machine.
> > 
> > I will plan to push it tomorrow.
> 
> Looks great work, except I *hate* :
> 
> +#define SDB_MALLOC(sp, dp, e, type, free_func) \
> +do {                                           \
> +       if (sp->e != NULL) {                   \
> +               dp->e = malloc(sizeof(type));  \
> +               if (dp->e == NULL) {           \
> +                       free_func(dp);         \
> +                       return ENOMEM;         \
> +               }                              \
> +               *dp->e = *sp->e;               \
> +       } else {                               \
> +               dp->e = NULL;                  \
> +       }                                      \
> +} while(0);
> 
> control-flow-macro :-(. I see why you've done
> it, but for the number of cases you ended up with
> you could have used a 'goto end' and do the free_func(dp)
> there, and do the rest of the code explicitly
> inline.
> 
> I won't NAK for this, but wanted to let you know
> someone is watching :-) :-).

I've changed the code and did everything inline. Pushed to autobuild now.

Thanks for your review!

-- 
Andreas Schneider                   GPG-ID: CC014E3D
Samba Team                             asn at samba.org
www.samba.org



More information about the samba-technical mailing list