From d74e904bf4bdd7f1d767a8db09987b90de809579 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Mon, 16 Mar 2015 10:00:32 +0100 Subject: clang-format-3.5 -i **/*.[ch], update modeline MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From here on, we’ll use clang-format to automatically format the source. This has worked well in i3, so we are introducing it for i3status. --- src/first_network_device.c | 53 +++++++++++++++++++++++----------------------- 1 file changed, 26 insertions(+), 27 deletions(-) (limited to 'src/first_network_device.c') diff --git a/src/first_network_device.c b/src/first_network_device.c index c160027..35cd4ff 100644 --- a/src/first_network_device.c +++ b/src/first_network_device.c @@ -1,4 +1,4 @@ -// vim:ts=8:expandtab +// vim:ts=4:sw=4:expandtab #include #include #include @@ -6,34 +6,33 @@ #include "i3status.h" const char *first_eth_interface(const net_type_t type) { - static char *interface = NULL; - struct ifaddrs *ifaddr, *addrp; - struct stat stbuf; - static char path[1024]; + static char *interface = NULL; + struct ifaddrs *ifaddr, *addrp; + struct stat stbuf; + static char path[1024]; - getifaddrs(&ifaddr); + getifaddrs(&ifaddr); - if (ifaddr == NULL) - return NULL; + if (ifaddr == NULL) + return NULL; - free(interface); - interface = NULL; - for (addrp = ifaddr; - addrp != NULL; - addrp = addrp->ifa_next) { - if (strncasecmp("lo", addrp->ifa_name, strlen("lo")) == 0) - continue; - // Skip this interface if it is a wireless interface. - snprintf(path, sizeof(path), "/sys/class/net/%s/wireless", addrp->ifa_name); - const bool is_wireless = (stat(path, &stbuf) == 0); - if (( is_wireless && type == NET_TYPE_ETHERNET) || - (!is_wireless && type == NET_TYPE_WIRELESS)) - continue; - interface = strdup(addrp->ifa_name); - break; - } + free(interface); + interface = NULL; + for (addrp = ifaddr; + addrp != NULL; + addrp = addrp->ifa_next) { + if (strncasecmp("lo", addrp->ifa_name, strlen("lo")) == 0) + continue; + // Skip this interface if it is a wireless interface. + snprintf(path, sizeof(path), "/sys/class/net/%s/wireless", addrp->ifa_name); + const bool is_wireless = (stat(path, &stbuf) == 0); + if ((is_wireless && type == NET_TYPE_ETHERNET) || + (!is_wireless && type == NET_TYPE_WIRELESS)) + continue; + interface = strdup(addrp->ifa_name); + break; + } - freeifaddrs(ifaddr); - return interface; + freeifaddrs(ifaddr); + return interface; } - -- cgit v1.2.3