libreplace vs. PARANOID_MALLOC_CHECKER

James Peach jpeach at samba.org
Wed Oct 18 03:32:05 GMT 2006


On Tue, 2006-10-17 at 10:22 +0200, Love Hörnquist Åstrand wrote:
> James, Tridge
> 
> >> Now, obviously this case is fixable, but IMO the #ifdef'ery  
> >> performed by
> >> libreplace is fragile and likely to keep stumbling over similar
> >> breakage. Is there any reason why I can't have libreplace provide  
> >> a real
> >> symbol named strndup(), without the #define or any other funny  
> >> business?
> >
> > We used to use the non-define approach, and hit just as many
> > problems. Jelmer proposed that the define approach was less
> > problematic and we switched to that.

Hmm. I guess the right way to do this would be to ship packages that use
libreplace as shared libraries and use a linker script to make sure that
only the package's API is exported. This would be a nightmare to get
right across all the platforms though.

I'll try metze's suggestion of using inline functions and see what the
binary size cost is. Otherwisse, I guess something in
PARANOID_MALLOC_CHECKER will have to give.

> This is my experice too, stomping on other's name-space is never a  
> good thing
> and will come back and bite you later.

Fair enough. Though I'd argue that stomping in the preprocessor
namespace is just as likely to bite you (and I already have 1 point on
the board!).

-- 
James Peach | jpeach at samba.org



More information about the samba-technical mailing list