summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-10-20 22:20:50 +0200
committerMarcel Holtmann <marcel@holtmann.org>2009-10-20 22:20:50 +0200
commit4152da7f4947c21903192ff47ff315f6b60d03ba (patch)
tree25a31a3b1a9867c3faa14fb56466f59dba335765
parent2b678e45fb3f53a2c59b5c8f00fe4f3b14f9de91 (diff)
downloadconnman-4152da7f4947c21903192ff47ff315f6b60d03ba.tar.gz
connman-4152da7f4947c21903192ff47ff315f6b60d03ba.tar.bz2
connman-4152da7f4947c21903192ff47ff315f6b60d03ba.zip
Fix some coding style issues and make it more readable
-rw-r--r--src/element.c28
-rw-r--r--src/inet.c7
-rw-r--r--src/ipconfig.c4
3 files changed, 23 insertions, 16 deletions
diff --git a/src/element.c b/src/element.c
index c8ca76e5..c5bac172 100644
--- a/src/element.c
+++ b/src/element.c
@@ -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;
diff --git a/src/inet.c b/src/inet.c
index 7f4d139a..ac68698b 100644
--- a/src/inet.c
+++ b/src/inet.c
@@ -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:
diff --git a/src/ipconfig.c b/src/ipconfig.c
index c18d36ba..62120354 100644
--- a/src/ipconfig.c
+++ b/src/ipconfig.c
@@ -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;
}