Change in osmo-sysmon[master]: openvpn: Remove useless conditional block in parse_state

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Mar 15 19:59:02 UTC 2019


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/13287


Change subject: openvpn: Remove useless conditional block in parse_state
......................................................................

openvpn: Remove useless conditional block in parse_state

tok != NULL is already checked in the for loop conditions.

Change-Id: I86e42e4537060b2ed8c860c0b71a225c5fe026c7
---
M src/osysmon_openvpn.c
1 file changed, 18 insertions(+), 19 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-sysmon refs/changes/87/13287/1

diff --git a/src/osysmon_openvpn.c b/src/osysmon_openvpn.c
index 3c03099..5d9af8a 100644
--- a/src/osysmon_openvpn.c
+++ b/src/osysmon_openvpn.c
@@ -98,25 +98,24 @@
 	}
 
 	for (tok = strtok(tmp, ","), i = 0; tok && i < MAX_RESP_COMPONENTS; tok = strtok(NULL, ",")) {
-		if (tok) { /* Parse csv string and pick interesting tokens while ignoring the rest. */
-			switch (i++) {
-			/* case 0: unix/date time, not needed */
-			case 1:
-				update_name(vpn->rem_cfg, tok);
-				break;
-			case 2:
-				snprintf(buf, sizeof(buf), "%s (%s)", vpn->rem_cfg->name, tok);
-				update_name(vpn->rem_cfg, buf);
-			case 3:
-				osmo_talloc_replace_string(vpn->rem_cfg, &vpn->tun_ip, tok);
-				break;
-			case 4:
-				update_host(vpn->rem_cfg, tok);
-				break;
-			case 5:
-				vpn->rem_cfg->remote_port = atoi(tok);
-				break;
-			}
+		/* Parse csv string and pick interesting tokens while ignoring the rest. */
+		switch (i++) {
+		/* case 0: unix/date time, not needed */
+		case 1:
+			update_name(vpn->rem_cfg, tok);
+			break;
+		case 2:
+			snprintf(buf, sizeof(buf), "%s (%s)", vpn->rem_cfg->name, tok);
+			update_name(vpn->rem_cfg, buf);
+		case 3:
+			osmo_talloc_replace_string(vpn->rem_cfg, &vpn->tun_ip, tok);
+			break;
+		case 4:
+			update_host(vpn->rem_cfg, tok);
+			break;
+		case 5:
+			vpn->rem_cfg->remote_port = atoi(tok);
+			break;
 		}
 	}
 	return NULL;

-- 
To view, visit https://gerrit.osmocom.org/13287
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-sysmon
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I86e42e4537060b2ed8c860c0b71a225c5fe026c7
Gerrit-Change-Number: 13287
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190315/a4386c2f/attachment.html>


More information about the gerrit-log mailing list