From 22103491a4171a55a2593bb1b727b086c13df7c6 Mon Sep 17 00:00:00 2001 From: Aki Niemi Date: Wed, 21 Apr 2010 10:47:16 +0300 Subject: gisi: move g_isi_modem_by_name to separate file This fixes build warnings that resulted from conflicts between linux/if.h and net/if.h. --- gisi/netlink.c | 23 ++++------------------- 1 file changed, 4 insertions(+), 19 deletions(-) (limited to 'gisi/netlink.c') diff --git a/gisi/netlink.c b/gisi/netlink.c index 6e37b333..1a18b458 100644 --- a/gisi/netlink.c +++ b/gisi/netlink.c @@ -76,21 +76,6 @@ struct _GPhonetNetlink { unsigned interface; }; -/* if_nametoindex is in #include , - but it is not compatible with */ - -extern unsigned if_nametoindex (char const *name); - -GIsiModem *g_isi_modem_by_name(char const *name) -{ - unsigned index = if_nametoindex(name); - - if (errno == 0) - errno = ENODEV; - - return (GIsiModem *)(void *)(uintptr_t)index; -} - static inline GIsiModem *make_modem(unsigned idx) { return (void *)(uintptr_t)idx; @@ -113,15 +98,15 @@ GPhonetNetlink *g_pn_netlink_by_modem(GIsiModem *idx) return NULL; } -GPhonetNetlink *g_pn_netlink_by_name(char const *ifname) +GPhonetNetlink *g_pn_netlink_by_name(const char *ifname) { if (ifname == NULL) { return g_pn_netlink_by_modem(make_modem(0)); } else { - unsigned index = if_nametoindex(ifname); - if (index == 0) + GIsiModem *idx = g_isi_modem_by_name(ifname); + if (!idx) return NULL; - return g_pn_netlink_by_modem(make_modem(index)); + return g_pn_netlink_by_modem(idx); } } -- cgit v1.2.3