[PATCH 1/2] Fix find_trip_by_idx() over-zealous cleanup

Linus Torvalds torvalds at linux-foundation.org
Tue Feb 19 11:10:36 PST 2013


From: Linus Torvalds <torvalds at linux-foundation.org>
Date: Tue, 19 Feb 2013 11:04:30 -0800
Subject: [PATCH 1/2] Fix find_trip_by_idx() over-zealous cleanup

Commit bcf1f8c4feb9 ("Don't do "remove_from_trip" by walking the gtk
data structures") made find_trip_by_idx() only work for negative indexes
(positive indexes are dives), but when it removed the unnecessary test
for negativity, the statement inside it should have been kept as
unconditional, rather than removed with the test.

Oops.

Signed-off-by: Linus Torvalds <torvalds at linux-foundation.org>
---

Oopsie. 

 divelist.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/divelist.c b/divelist.c
index 8dac63f34ceb..08f47121c4ea 100644
--- a/divelist.c
+++ b/divelist.c
@@ -1035,7 +1035,7 @@ static dive_trip_t *find_trip_by_idx(int idx)
 
 	if (idx >= 0)
 		return NULL;
-
+	idx = -idx;
 	while (trip) {
 		if (trip->index == idx)
 			return trip;
-- 
1.8.1.3.556.gb3310b5



More information about the subsurface mailing list