]> git.sur5r.net Git - i3/i3status/commitdiff
Little style fixes for the last commit
authorMichael Stapelberg <michael@stapelberg.de>
Tue, 6 Apr 2010 12:52:13 +0000 (14:52 +0200)
committerMichael Stapelberg <michael@stapelberg.de>
Tue, 6 Apr 2010 12:55:22 +0000 (14:55 +0200)
src/print_ipv6_addr.c

index bfd985d1a92ebc6e83f3b4aafd358654e197c8ab..b370011f0ac0e53fe24fa02a3aea37c418bbb0f2 100644 (file)
@@ -9,7 +9,7 @@
 #include <string.h>
 #include <arpa/inet.h>
 
-static char * get_sockname(struct addrinfo *addr) {
+static char *get_sockname(struct addrinfo *addr) {
         static char buf[INET6_ADDRSTRLEN+1];
         struct sockaddr_storage local;
         int ret;
@@ -34,7 +34,6 @@ static char * get_sockname(struct addrinfo *addr) {
                 return NULL;
         }
 
-
         socklen_t local_len = sizeof(struct sockaddr_storage);
         if (getsockname(fd, (struct sockaddr*)&local, &local_len) == -1) {
                 perror("getsockname()");
@@ -105,21 +104,22 @@ static char *get_ipv6_addr() {
 
 void print_ipv6_info(const char *format_up, const char *format_down) {
         const char *walk;
-        char * addr_string = get_ipv6_addr();
-        
+        char *addr_string = get_ipv6_addr();
+
         if (addr_string == NULL) {
                 printf("%s", format_down);
-        } else {
-                for (walk = format_up; *walk != '\0'; walk++) {
-                        if (*walk != '%') {
-                                putchar(*walk);
-                                continue;
-                        }
-                        
-                        if (strncmp(walk+1, "ip", strlen("ip")) == 0) {
-                                printf("%s", addr_string);
-                                walk += strlen("ip");
-                        }
+                return;
+        }
+
+        for (walk = format_up; *walk != '\0'; walk++) {
+                if (*walk != '%') {
+                        putchar(*walk);
+                        continue;
+                }
+
+                if (strncmp(walk+1, "ip", strlen("ip")) == 0) {
+                        printf("%s", addr_string);
+                        walk += strlen("ip");
                 }
         }
 }