Remove talloc from libwbclient

simo idra at samba.org
Sat Feb 6 12:02:15 MST 2010


On Sat, 2010-02-06 at 17:36 +0100, Volker Lendecke wrote:
> Hi!
> 
> In order to make libwbclient thread-safe, I would like to
> remove the use of talloc inside. I have also seen problems
> when the symbols get overwritten by talloc.so, so including
> a full talloc version from my point of view is a bad idea.

I don't like to say the famous words "I told you so ..." but I can't
resist ...

I think that libwbclient should really be as slim as possible if the
intention is to have it used by other apps, or, alternatively, make it
explicitly use talloc in a thread-safe way, and *never* statically build
talloc in it.

> We have to modify memory handling, in particular
> wbcFreeMemory though:
> 
> 1. Add destructors preceding the memory blob returned
> 
> 2. Change all of libwbclient to only ever allocate a single
> blob
> 
> 3. Replace wbcFreeMemory by wbcFreeSomething per structure
> 
> I really prefer 3., this is what most other libraries do,
> and I think it is the cleanest way to go. The other two are
> pretty ugly to implement, but 3. is a change in the API.
> 
> Comments?

A change in the API is usually a bad thing, the whole point of
libwbclient was to build an API/ABI that wouldn't change so that people
could use it. So, personally, I'd go with number 1, it may be a bit ugly
but it won't break the API.

Of course none of this is necessary if we make system talloc an explicit
dependency and stop statically linking in talloc (this is the real
issue, and it is an issue in any public library we want to build), then
the only thing you need to make sure of is that talloc is used in a
thread-safe way, which shouldn't be too difficult within libwbclient.

Simo.

-- 
Simo Sorce
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>



More information about the samba-technical mailing list