[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Bug#685625: implicit declaration of function ‘reallocf’



[snipped astute observations about the size of the xml data being important]

On Fri, Dec 21, 2012 at 10:02:45PM +0000, Steven Chamberlain wrote:
> And I'm worried about some of the other packages mentioned, where the
> error shows on kfreebsd-* or maybe hurd-*, but not on other arches.
> Should they really all be doing this:
> 
> > ++#include <bsd/stdlib.h>
> 
> Or should we be trying to fix this elsewhere, in GNU/kFreeBSD headers maybe?

I don't know the right fix.  I chose to #include <bsd/stdlib.h> because the
manpage (on debian-kFreeBSD) lists that as the proper header:

debian-kFreeBSD$ man reallocf
MALLOC(3)                BSD Library Functions Manual                MALLOC(3)

NAME
     reallocf — general purpose memory allocation functions

LIBRARY
     Utility functions from BSD systems (libbsd, -lbsd)

SYNOPSIS
     #include <bsd/stdlib.h>

     void *
     reallocf(void *ptr, size_t size);

I notice now that the guidance in the FreeBSD project's manpage is to simply
include <stdlib.h> for the declaration of reallocf:
    http://www.freebsd.org/cgi/man.cgi?query=reallocf

Unless you were going to put reallocf in eglibc I don't think you want it in
<stdlib.h>, since on debian-kFreeBSD use of reallocf will result in a link
error without -lbsd.

You can't simply make the bsd header be included via #include <stdlib.h>, as
-I/usr/include/bsd on the gcc commandline leads to a recursive inclusion error.

Jeff


Reply to: