[FFmpeg-devel] [PATCH] adding _GNU_SOURCE for udp.c compilation
Mon Feb 11 03:14:42 CET 2008
On Sun, Feb 10, 2008 at 07:20:31PM +0100, Nicolas George wrote:
> Le duodi 22 pluvi?se, an CCXVI, Reimar D?ffinger a ?crit?:
> > Well in my header file (gentoo and debian) they are claimed to be part of
> > POSIX1.g, so they are not under a GNU ifdef.
> > Though I admit I could not find it in the POSIX specs I had lying
> > around.
> Neither NI_MAXSERV nor NI_MAXHOST appear in the Single Unix Specification
> version 3, which is a superset of POSIX.
> shows that the check for _GNU_SOURCE has been added three weeks ago, with
> the log message "Cleanup namespace.".
> getnameinfo seems to return EAI_OVERFLOW if the buffers are not big enough.
> EAI_OVERFLOW is standard, and described in the SUSv3 about netdb.h, but not
> referenced in the page about getnameinfo.
> I fear that the only absolutely reliable way of doing this is to increase
> dynamically the buffer each time EAI_OVERFLOW is returned. Yet, using
> NI_MAX* when they are defined as the initial size for the buffer should be
> helpful nonetheless.
For the service number (port), sizeof(int)*3 is a perfectly acceptable
bound. This function does not even make use of the hbuf result so it
should be passing a null pointer for that rather than wasting
complexity and stack space.
More information about the ffmpeg-devel