DAL cleanup project proposal

Greg Hudson ghudson at MIT.EDU
Sun Jul 4 14:29:12 EDT 2010


On Sun, 2010-07-04 at 13:58 -0400, Simo Sorce wrote:
> Does this means we can potentially have more allocations when
> enumerating principals ?
> Passing down a buffer allows you to reuse the same one over and over
> with out any allocation if you want to.
> Of course if the code was already allocating a buffer before each
> get_principal call the point is moot.

Filling in a caller-allocated container is slightly more efficient (the
caller can stack-allocate the container, for instance, and in this case
usually does).  But avoiding one allocation is a pretty tiny
optimization relative to what goes on in a database lookup.

Overall in krb5, we have a mix of caller-allocates-container and
API-allocates-container, presumably because some developers have valued
the small efficiency benefits of the first approach and others have
valued the simpler semantics of the second approach.  Unfortunately,
having a mix makes our APIs harder to understand.  I would like libkdb5
to be consistent about caller vs. API container allocation for principal
and policy lookups.





More information about the krbdev mailing list