aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYang Tse <yangsita@gmail.com>2011-12-13 18:37:33 +0100
committerYang Tse <yangsita@gmail.com>2011-12-13 18:37:33 +0100
commit4c4e8ba1f060fdba2822da5ad498c7876cedd18b (patch)
treedafb4dfe9a31624cc01fc5e7db69fc417263bc2e
parentde6f4f356e4b35c17f55c3a2f98e9ea4adeb7fff (diff)
if2ip.[ch]: fix compilation with MinGW
Avoid 'interface' literal that some MinGW versions define as a macro
-rw-r--r--lib/if2ip.c24
-rw-r--r--lib/if2ip.h4
2 files changed, 14 insertions, 14 deletions
diff --git a/lib/if2ip.c b/lib/if2ip.c
index c253ed5d1..055ee7aa0 100644
--- a/lib/if2ip.c
+++ b/lib/if2ip.c
@@ -71,7 +71,7 @@
#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;
@@ -79,7 +79,7 @@ bool Curl_if_is_interface_name(const char *interface)
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;
}
diff --git a/lib/if2ip.h b/lib/if2ip.h
index 8b1979ba7..99821b7c6 100644
--- a/lib/if2ip.h
+++ b/lib/if2ip.h
@@ -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>