Permalink
Browse files

if2ip.[ch]: fix compilation with MinGW

Avoid 'interface' literal that some MinGW versions define as a macro
  • Loading branch information...
1 parent de6f4f3 commit 4c4e8ba1f060fdba2822da5ad498c7876cedd18b @yangtse yangtse committed Dec 13, 2011
Showing with 14 additions and 14 deletions.
  1. +12 −12 lib/if2ip.c
  2. +2 −2 lib/if2ip.h
View
@@ -71,15 +71,15 @@
#if defined(HAVE_GETIFADDRS)
-bool Curl_if_is_interface_name(const char *interface)
+bool Curl_if_is_interface_name(const char *interf)
{
bool result = FALSE;
struct ifaddrs *iface, *head;
if(getifaddrs(&head) >= 0) {
for(iface=head; iface != NULL; iface=iface->ifa_next) {
- if(curl_strequal(iface->ifa_name, interface)) {
+ if(curl_strequal(iface->ifa_name, interf)) {
result = TRUE;
break;
}
@@ -89,7 +89,7 @@ bool Curl_if_is_interface_name(const char *interface)
return result;
}
-char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
+char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size)
{
struct ifaddrs *iface, *head;
char *ip = NULL;
@@ -98,7 +98,7 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
for(iface=head; iface != NULL; iface=iface->ifa_next) {
if((iface->ifa_addr != NULL) &&
(iface->ifa_addr->sa_family == af) &&
- curl_strequal(iface->ifa_name, interface)) {
+ curl_strequal(iface->ifa_name, interf)) {
void *addr;
char scope[12]="";
#ifdef ENABLE_IPV6
@@ -127,17 +127,17 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
#elif defined(HAVE_IOCTL_SIOCGIFADDR)
-bool Curl_if_is_interface_name(const char *interface)
+bool Curl_if_is_interface_name(const char *interf)
{
/* This is here just to support the old interfaces */
char buf[256];
- char *ip = Curl_if2ip(AF_INET, interface, buf, sizeof(buf));
+ char *ip = Curl_if2ip(AF_INET, interf, buf, sizeof(buf));
return (ip != NULL) ? TRUE : FALSE;
}
-char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
+char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size)
{
struct ifreq req;
struct in_addr in;
@@ -146,10 +146,10 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
size_t len;
char *ip;
- if(!interface || (af != AF_INET))
+ if(!interf || (af != AF_INET))
return NULL;
- len = strlen(interface);
+ len = strlen(interf);
if(len >= sizeof(req.ifr_name))
return NULL;
@@ -158,7 +158,7 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
return NULL;
memset(&req, 0, sizeof(req));
- memcpy(req.ifr_name, interface, len+1);
+ memcpy(req.ifr_name, interf, len+1);
req.ifr_addr.sa_family = AF_INET;
if(ioctl(dummy, SIOCGIFADDR, &req) < 0) {
@@ -176,9 +176,9 @@ char *Curl_if2ip(int af, const char *interface, char *buf, int buf_size)
#else
-bool Curl_if_is_interface_name(const char *interface)
+bool Curl_if_is_interface_name(const char *interf)
{
- (void) interface;
+ (void) interf;
return FALSE;
}
View
@@ -23,8 +23,8 @@
***************************************************************************/
#include "setup.h"
-extern bool Curl_if_is_interface_name(const char *interface);
-extern char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size);
+bool Curl_if_is_interface_name(const char *interf);
+char *Curl_if2ip(int af, const char *interf, char *buf, int buf_size);
#ifdef __INTERIX
#include <sys/socket.h>

0 comments on commit 4c4e8ba

Please sign in to comment.