use of malloc.h in KDE
Andy Fawcett
andy at athame.co.uk
Fri Nov 22 10:39:12 GMT 2002
On Friday 22 November 2002 10:51, Andy Fawcett wrote:
> Hi,
>
> I just installed FreeBSD 5.0DP2, which is basically a developer
> preview of the upcoming version, due for release next month.
>
> I'm running test builds of KDE CVS on it, and one thing that has
> cropped up in a few places is the inclusion of <malloc.h>.
>
> Previous versions of FreeBSD's compiler have generated a #warning
> saying that this is deprecated, and that <stdlib.h> instead.
>
> The new version throws a #error, with the same basic message, causing
> some parts of KDE to fail to build.
>
> So...
>
> I am wondering how best to fix this in KDE, as I (and the rest of the
> KDE/FreeBSD team, as well as others) really would like to see FreeBSD
> 5.0 as a supported OS, given that it is being released soon.
>
> I could wrap the #include like this:
>
> #if !defined(__FreeBSD__)
> #include <malloc.h>
> #endif
>
> but that is so messy. I looked to see if there was an auto* check for
> a _working_ malloc.h, but I cannot find one.
>
> I don't want to commit stuff that is messy, but are there any better
> alternatives?
After a little research, it _seems_ that most (all?) major
implementations of unix have a malloc definition in <stdlib.h>, so we
could just do a straightforward replace.
The only problem with this is that I cannot be sure to catch all
implementations that way, and at this late stage it's a risk. I don't
want to be the cause of a build failing elsewhere, but I would like to
fix this now.
Would it make sense to do the replace now, and those implementations
that still need <malloc.h> could include it conditionally?
Does anyone see any danger in this?
A.
--
Andy Fawcett | "In an open world without walls and fences,
andy at athame.co.uk | we wouldn't need Windows and Gates."
tap at lspace.org | -- anon
More information about the kde-core-devel
mailing list