# include "config.h"
#endif
-#include <vlc/vlc.h>
+#include <vlc_common.h>
#include <stddef.h> /* size_t */
#include <string.h> /* strlen(), memcpy(), memset(), strchr() */
#ifndef HAVE_GAI_STRERROR
static const struct
{
- char code;
- const char msg[41]
+ int code;
+ const char msg[41];
} gai_errlist[] =
{
{ 0, "Error 0" },
{ EAI_MEMORY, "Memory allocation failure" },
{ EAI_OVERFLOW, "Buffer overflow" },
{ EAI_SYSTEM, "System error" },
- { 0, NULL }
+ { 0, "" },
};
static const char gai_unknownerr[] = "Unrecognized error number";
****************************************************************************/
const char *vlc_gai_strerror (int errnum)
{
- for (unsigned i = 0; gai_errlist[i].msg != NULL; i++)
+ for (unsigned i = 0; *gai_errlist[i].msg; i++)
if (errnum == gai_errlist[i].code)
return gai_errlist[i].msg;
NI_DGRAM)
/*
* getnameinfo() non-thread-safe IPv4-only implementation,
- * Address-family-independant address to hostname translation
+ * Address-family-independent address to hostname translation
* (reverse DNS lookup in case of IPv4).
*
* This is meant for use on old IP-enabled systems that are not IPv6-aware,
/*
* getaddrinfo() non-thread-safe IPv4-only implementation
- * Address-family-independant hostname to address resolution.
+ * Address-family-independent hostname to address resolution.
*
* This is meant for IPv6-unaware systems that do probably not provide
* getaddrinfo(), but still have old function gethostbyname().
AI_PASSIVE |
AI_CANONNAME |
AI_NUMERICHOST |
-#ifdef AI_NUMERICSERV
AI_NUMERICSERV |
-#endif
#ifdef AI_ALL
AI_ALL |
#endif
hints.ai_flags = p_hints->ai_flags & safe_flags;
}
-#ifdef AI_NUMERICSERV
/* We only ever use port *numbers* */
hints.ai_flags |= AI_NUMERICSERV;
-#endif
if( hints.ai_family == AF_UNSPEC )
{
hints.ai_flags &= ~AI_NUMERICHOST;
}
#endif
-#if defined (HAVE_GETADDRINFO)
-# ifdef AI_IDN
+#ifdef AI_IDN
/* Run-time I18n Domain Names support */
hints.ai_flags |= AI_IDN;
int ret = getaddrinfo (psz_node, psz_service, &hints, res);
/* IDN not available: disable and retry without it */
hints.ai_flags &= ~AI_IDN;
-# endif
- return getaddrinfo (psz_node, psz_service, &hints, res);
-#else
- int ret;
- vlc_value_t lock;
-
- var_Create (p_this->p_libvlc, "getaddrinfo_mutex", VLC_VAR_MUTEX);
- var_Get (p_this->p_libvlc, "getaddrinfo_mutex", &lock);
- vlc_mutex_lock (lock.p_address);
-
- ret = getaddrinfo (psz_node, psz_service, &hints, res);
- vlc_mutex_unlock (lock.p_address);
- return ret;
#endif
+ return getaddrinfo (psz_node, psz_service, &hints, res);
}