Change in osmo-pcu[master]: gsm_timer: fix comparison of constant LONG_MAX with an integer

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/.

fixeria gerrit-no-reply at lists.osmocom.org
Fri Jan 24 22:26:45 UTC 2020


fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-pcu/+/17006 )


Change subject: gsm_timer: fix comparison of constant LONG_MAX with an integer
......................................................................

gsm_timer: fix comparison of constant LONG_MAX with an integer

It does not make sense since INT_MAX is always less than LONG_MAX.
Found by Clang [-Wtautological-constant-out-of-range-compare].

Change-Id: I9934e05aa050bf93b3c795376f5dca3a848a7e11
---
M src/gsm_timer.cpp
1 file changed, 7 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-pcu refs/changes/06/17006/1

diff --git a/src/gsm_timer.cpp b/src/gsm_timer.cpp
index f7901d4..cefe520 100644
--- a/src/gsm_timer.cpp
+++ b/src/gsm_timer.cpp
@@ -144,17 +144,14 @@
 
 static void update_nearest(int *cand, int *current)
 {
-	if (*cand != LONG_MAX) {
-		if (*cand > *current)
-			nearest = *cand - *current;
-		else {
-			/* loop again inmediately */
-			nearest = 0;
-		}
-		nearest_p = &nearest;
-	} else {
-		nearest_p = NULL;
+	if (*cand > *current)
+		nearest = *cand - *current;
+	else {
+		/* loop again inmediately */
+		nearest = 0;
 	}
+
+	nearest_p = &nearest;
 }
 
 /*

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-pcu/+/17006
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-pcu
Gerrit-Branch: master
Gerrit-Change-Id: I9934e05aa050bf93b3c795376f5dca3a848a7e11
Gerrit-Change-Number: 17006
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200124/eff08249/attachment.htm>


More information about the gerrit-log mailing list