[PATCHSET] Introduce SDB - a KDC backend abstraction

Jeremy Allison jra at samba.org
Wed Jul 29 21:18:44 UTC 2015


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 :-) :-).



More information about the samba-technical mailing list