]> git.sur5r.net Git - i3/i3status/commitdiff
- Remove some superfluous #ifdef clutter - If we're compiling on !(Linux or FreeBSD...
authorJasper Lievisse Adriaanse <jasper@humppa.nl>
Fri, 4 May 2012 07:36:38 +0000 (09:36 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Fri, 4 May 2012 14:10:19 +0000 (16:10 +0200)
src/print_eth_info.c

index 90005bf5fc0c2199a813d74236948c8b334c33f3..941b46582f74f5790274aaa850bceaf8c151b7f0 100644 (file)
 #endif
 
 static int print_eth_speed(char *outwalk, const char *interface) {
-#if defined(LINUX)
-        int ethspeed = 0;
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
-        char *ethspeed;
-#endif
-
 #if defined(LINUX)
         /* This code path requires root privileges */
+        int ethspeed = 0;
         struct ifreq ifr;
         struct ethtool_cmd ecmd;
 
@@ -49,6 +44,7 @@ static int print_eth_speed(char *outwalk, const char *interface) {
                 return sprintf(outwalk, "%d Mbit/s", ethspeed);
         } else return sprintf(outwalk, "?");
 #elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
+        char *ethspeed;
         struct ifmediareq ifm;
         (void)memset(&ifm, 0, sizeof(ifm));
         (void)strncpy(ifm.ifm_name, interface, sizeof(ifm.ifm_name));
@@ -69,6 +65,8 @@ static int print_eth_speed(char *outwalk, const char *interface) {
         }
         ethspeed = (desc->ifmt_string != NULL ? desc->ifmt_string : "?");
         return sprintf(outwalk, "%s", ethspeed);
+#else
+       return sprintf(outwalk, "?");
 #endif
 }