Fix some coding style issues and make it more readable
authorMarcel Holtmann <marcel@holtmann.org>
Tue, 20 Oct 2009 20:20:50 +0000 (22:20 +0200)
committerMarcel Holtmann <marcel@holtmann.org>
Tue, 20 Oct 2009 20:20:50 +0000 (22:20 +0200)
src/element.c
src/inet.c
src/ipconfig.c

index c8ca76e509734c8643f2fc02d3e61dda03eba002..c5bac172504f697eb1a73cf953248b4ca14cf8f1 100644 (file)
@@ -1374,16 +1374,23 @@ static void register_element(gpointer data, gpointer user_data)
 
 gboolean __connman_element_device_isfiltered(const char *devname)
 {
-       if (device_filter != NULL &&
-                       g_pattern_match_simple(device_filter, devname) == FALSE) {
-               DBG("ignoring device %s (no match)", devname);
+       if (device_filter == NULL)
+               goto nodevice;
+
+       if (g_pattern_match_simple(device_filter, devname) == FALSE) {
+               DBG("ignoring device %s (match)", devname);
                return TRUE;
        }
-       if (nodevice_filter != NULL &&
-                       g_pattern_match_simple(nodevice_filter, devname) == TRUE) {
-               DBG("ignoring device %s (match no)", devname);
+
+nodevice:
+       if (nodevice_filter == NULL)
+               return FALSE;
+
+       if (g_pattern_match_simple(nodevice_filter, devname) == TRUE) {
+               DBG("ignoring device %s (no match)", devname);
                return TRUE;
        }
+
        return FALSE;
 }
 
@@ -1405,12 +1412,13 @@ int connman_element_register(struct connman_element *element,
        if (element->devname == NULL)
                element->devname = g_strdup(element->name);
 
-       if (element->type == CONNMAN_ELEMENT_TYPE_DEVICE &&
-                       __connman_element_device_isfiltered(element->devname) == TRUE) {
-               DBG("ignoring %s [%s] device", element->name, element->devname);
+        if (element->type != CONNMAN_ELEMENT_TYPE_DEVICE)
+               goto setup;
+
+       if (__connman_element_device_isfiltered(element->devname) == TRUE)
                return -EPERM;
-       }
 
+setup:
        if (connman_element_ref(element) == NULL)
                return -EINVAL;
 
index 7f4d139a791d846559e1e93231a0b25c74dd8ac2..ac68698b363c27bd43e53ea531f9b8eb25bcd12b 100644 (file)
@@ -441,9 +441,9 @@ struct connman_device *connman_inet_create_device(int index)
        devname = connman_inet_ifname(index);
        if (devname == NULL)
                return NULL;
+
        if (__connman_element_device_isfiltered(devname) == TRUE) {
-               connman_info("Ignoring network interface %s (filtered)",
-                   devname);
+               connman_info("Ignoring interface %s (filtered)", devname);
                return NULL;
        }
 
@@ -453,8 +453,7 @@ struct connman_device *connman_inet_create_device(int index)
 
        switch (type) {
        case CONNMAN_DEVICE_TYPE_UNKNOWN:
-               connman_info("Ignoring network interface %s (type unknown)",
-                   devname);
+               connman_info("Ignoring interface %s (type unknown)", devname);
                g_free(devname);
                return NULL;
        case CONNMAN_DEVICE_TYPE_ETHERNET:
index c18d36ba346f4f7b6f918c52cd8cc6775b42965f..62120354051a653960de43e3f1aab5b8db0493b7 100644 (file)
@@ -304,9 +304,9 @@ void __connman_ipconfig_newlink(int index, unsigned short type,
                goto update;
 
        ifname = connman_inet_ifname(index);
+
        if (__connman_element_device_isfiltered(ifname) == TRUE) {
-               connman_info("Ignoring network interface %s (filtered)",
-                   ifname);
+               connman_info("Ignoring interface %s (filtered)", ifname);
                g_free(ifname);
                return;
        }