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/.
Stefan Sperling gerrit-no-reply at lists.osmocom.orgStefan Sperling has uploaded this change for review. ( https://gerrit.osmocom.org/11698
Change subject: re-order condition checks for clarity
......................................................................
re-order condition checks for clarity
Coverity points out that conditional checks in set_net_timezone()
depend on each other: The value of 'override' depends on 'hourstr'
being non-NULL. Nest these conditional checks such that this
dependency becomes obvious.
No functional change.
Change-Id: I10dece1e1d9e039fb9f03be89b3a202cb077b026
Related: CID#148208
---
M src/osmo-bsc/osmo_bsc_ctrl.c
1 file changed, 9 insertions(+), 10 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/98/11698/1
diff --git a/src/osmo-bsc/osmo_bsc_ctrl.c b/src/osmo-bsc/osmo_bsc_ctrl.c
index a4a9a36..80699f8 100644
--- a/src/osmo-bsc/osmo_bsc_ctrl.c
+++ b/src/osmo-bsc/osmo_bsc_ctrl.c
@@ -512,8 +512,9 @@
static int set_net_timezone(struct ctrl_cmd *cmd, void *data)
{
char *saveptr, *hourstr, *minstr, *dststr, *tmp = 0;
- int override;
+ int override = 0;
struct gsm_network *net = (struct gsm_network*)cmd->node;
+ struct gsm_tz *tz = &net->tz;
tmp = talloc_strdup(cmd, cmd->value);
if (!tmp)
@@ -523,19 +524,17 @@
minstr = strtok_r(NULL, ",", &saveptr);
dststr = strtok_r(NULL, ",", &saveptr);
- override = 0;
-
- if (hourstr != NULL)
+ if (hourstr != NULL) {
override = strcasecmp(hourstr, "off") != 0;
+ if (override) {
+ tz->hr = atol(hourstr);
+ tz->mn = minstr ? atol(minstr) : 0;
+ tz->dst = dststr ? atol(dststr) : 0;
+ }
+ }
- struct gsm_tz *tz = &net->tz;
tz->override = override;
- if (override) {
- tz->hr = hourstr ? atol(hourstr) : 0;
- tz->mn = minstr ? atol(minstr) : 0;
- tz->dst = dststr ? atol(dststr) : 0;
- }
talloc_free(tmp);
tmp = NULL;
--
To view, visit https://gerrit.osmocom.org/11698
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bsc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I10dece1e1d9e039fb9f03be89b3a202cb077b026
Gerrit-Change-Number: 11698
Gerrit-PatchSet: 1
Gerrit-Owner: Stefan Sperling <ssperling at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181108/e5d1a371/attachment.htm>