Reformat all code using astyle.
authorGuus Sliepen <guus@tinc-vpn.org>
Sat, 17 Feb 2018 13:39:29 +0000 (14:39 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 17 Feb 2018 13:39:29 +0000 (14:39 +0100)
src/address_cache.c
src/event.c
src/mingw/device.c
src/net_packet.c
src/net_socket.c

index ff5850c..381ae78 100644 (file)
@@ -85,14 +85,16 @@ void add_recent_address(address_cache_t *cache, const sockaddr_t *sa) {
        unsigned int pos = find_cached(cache, sa);
 
        // It's in the first spot, so nothing to do
-       if (pos == 0) {
+       if(pos == 0) {
                return;
        }
 
        // Shift everything, move/add the address to the first slot
        if(pos == NOT_CACHED) {
-               if(cache->data.used < MAX_CACHED_ADDRESSES)
+               if(cache->data.used < MAX_CACHED_ADDRESSES) {
                        cache->data.used++;
+               }
+
                pos = cache->data.used - 1;
        }
 
index 84b18b3..331872a 100644 (file)
@@ -41,12 +41,15 @@ static int io_compare(const io_t *a, const io_t *b) {
 #ifndef HAVE_MINGW
        return a->fd - b->fd;
 #else
+
        if(a->event < b->event) {
                return -1;
        }
+
        if(a->event > b->event) {
                return 1;
        }
+
        return 0;
 #endif
 }
index eb3663d..2cce1f2 100644 (file)
@@ -72,6 +72,7 @@ static void device_issue_read() {
 
 static void device_handle_read(void *data, int flags) {
        DWORD len;
+
        if(!GetOverlappedResult(device_handle, &device_read_overlapped, &len, FALSE)) {
                logger(DEBUG_ALWAYS, LOG_ERR, "Error getting read result from %s %s: %s", device_info,
                       device, strerror(errno));
index c8f48d3..d37f220 100644 (file)
@@ -158,8 +158,11 @@ static void udp_probe_h(node_t *n, vpn_packet_t *packet, length_t len) {
        if(!n->status.udp_confirmed) {
                n->status.udp_confirmed = true;
                fprintf(stderr, "Updating address cache...\n");
-               if (!n->address_cache)
+
+               if(!n->address_cache) {
                        n->address_cache = open_address_cache(n);
+               }
+
                reset_address_cache(n->address_cache, &n->address);
        }
 
index 4fbcf57..cd6a5c2 100644 (file)
@@ -815,11 +815,13 @@ void try_outgoing_connections(void) {
                if(!found) {
                        outgoing_t *outgoing = xzalloc(sizeof(*outgoing));
                        node_t *n = lookup_node(name);
+
                        if(!n) {
                                n = new_node();
                                n->name = xstrdup(name);
                                node_add(n);
                        }
+
                        outgoing->node = n;
                        list_insert_tail(outgoing_list, outgoing);
                        setup_outgoing_connection(outgoing, true);