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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Fri Mar 15 23:38:45 UTC 2019


Pau Espin Pedrol has submitted this change and it was merged. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



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: merged
Gerrit-Change-Id: I86e42e4537060b2ed8c860c0b71a225c5fe026c7
Gerrit-Change-Number: 13287
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190315/70080239/attachment.htm>


More information about the gerrit-log mailing list