diff options
author | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-13 11:52:50 +0200 |
---|---|---|
committer | Holger Hans Peter Freyther <holger@moiji-mobile.com> | 2013-07-27 22:14:45 +0200 |
commit | 51c57045e533caaa51ca5acf8929628c21dd6b94 (patch) | |
tree | 4939868db25401166dc665c9e4c1441153af35ce | |
parent | a004e6a8233695abd417a97d6f81a802b605038a (diff) |
misc: Remove if (timer_pending) stop_timer idiom from the code
osmo_timer_del is an idempotent operation. There is no requirement
to check if it is running. If you don't want a timer to run, delete
it. Maybe one should have called the method _unschedule, _cancel to
make this more clear.
-rw-r--r-- | src/gprs_bssgp_pcu.cpp | 6 | ||||
-rw-r--r-- | src/sysmo_sock.cpp | 3 |
2 files changed, 3 insertions, 6 deletions
diff --git a/src/gprs_bssgp_pcu.cpp b/src/gprs_bssgp_pcu.cpp index 54753b85..c7919138 100644 --- a/src/gprs_bssgp_pcu.cpp +++ b/src/gprs_bssgp_pcu.cpp @@ -515,8 +515,7 @@ static int nsvc_signal_cb(unsigned int subsys, unsigned int signal, case S_NS_BLOCK: if (nsvc_unblocked) { nsvc_unblocked = 0; - if (osmo_timer_pending(&bvc_timer)) - osmo_timer_del(&bvc_timer); + osmo_timer_del(&bvc_timer); bvc_sig_reset = 0; bvc_reset = 0; bvc_unblocked = 0; @@ -646,8 +645,7 @@ void gprs_bssgp_destroy(void) if (!bssgp_nsi) return; - if (osmo_timer_pending(&bvc_timer)) - osmo_timer_del(&bvc_timer); + osmo_timer_del(&bvc_timer); osmo_signal_unregister_handler(SS_L_NS, nsvc_signal_cb, NULL); diff --git a/src/sysmo_sock.cpp b/src/sysmo_sock.cpp index a4cc6ded..d4fb5a6c 100644 --- a/src/sysmo_sock.cpp +++ b/src/sysmo_sock.cpp @@ -304,8 +304,7 @@ void pcu_l1if_close(void) if (!state) return; - if (osmo_timer_pending(&state->timer)) - osmo_timer_del(&state->timer); + osmo_timer_del(&state->timer); bfd = &state->conn_bfd; if (bfd->fd > 0) |