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
Tue Jan 28 23:34:18 UTC 2020


fixeria has submitted this change. ( 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(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, but someone else must approve
  pespin: Looks good to me, approved



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: 2
Gerrit-Owner: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <axilirator at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200128/7c311c83/attachment.htm>


More information about the gerrit-log mailing list