Patchwork [RFC,5/5] hostapd: Reduce indention in vlan_dynamic_add

login
register
mail settings
Submitter Helmut Schaa
Date March 17, 2014, 1:16 p.m.
Message ID <1395062188-13222-6-git-send-email-helmut.schaa@googlemail.com>
Download mbox | patch
Permalink /patch/331040/
State New
Headers show

Comments

Helmut Schaa - March 17, 2014, 1:16 p.m.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
---
 src/ap/vlan_init.c | 30 ++++++++++++++----------------
 1 file changed, 14 insertions(+), 16 deletions(-)

Patch

diff --git a/src/ap/vlan_init.c b/src/ap/vlan_init.c
index 4835860..cd775c7 100644
--- a/src/ap/vlan_init.c
+++ b/src/ap/vlan_init.c
@@ -931,25 +931,23 @@  int vlan_setup_encryption_dyn(struct hostapd_data *hapd,
 static int vlan_dynamic_add(struct hostapd_data *hapd,
 			    struct hostapd_vlan *vlan)
 {
-	while (vlan) {
-		if (vlan->vlan_id != VLAN_ID_WILDCARD) {
-			if (hostapd_vlan_if_add(hapd, vlan->ifname,
-						vlan->bridge[0] == '\0' ?
-						NULL : vlan->bridge)) {
-				if (errno != EEXIST) {
-					wpa_printf(MSG_ERROR, "VLAN: Could "
-						   "not add VLAN %s: %s",
-						   vlan->ifname,
-						   strerror(errno));
-					return -1;
-				}
+	for (; vlan; vlan = vlan->next) {
+		if (vlan->vlan_id == VLAN_ID_WILDCARD)
+			continue;
+
+		if (hostapd_vlan_if_add(hapd, vlan->ifname,
+					vlan->bridge[0] == '\0' ?
+					NULL : vlan->bridge)) {
+			if (errno != EEXIST) {
+				wpa_printf(MSG_ERROR, "VLAN: Could "
+					   "not add VLAN %s: %s",
+					   vlan->ifname, strerror(errno));
+				return -1;
 			}
+		}
 #ifdef CONFIG_FULL_DYNAMIC_VLAN
-			ifconfig_up(vlan->ifname);
+		ifconfig_up(vlan->ifname);
 #endif /* CONFIG_FULL_DYNAMIC_VLAN */
-		}
-
-		vlan = vlan->next;
 	}
 
 	return 0;