From 8d2bc595c73f4a08ea80ddc661c99c6bb2c55358 Mon Sep 17 00:00:00 2001 From: Stefan Fuchs Date: Mon, 27 Nov 2017 20:37:19 +0100 Subject: [PATCH] Code cleanup: Move index declarations into for loop Signed-off-by: Stefan Fuchs --- core/equipment.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/core/equipment.c b/core/equipment.c index 8a3b172ef..a1b731a14 100644 --- a/core/equipment.c +++ b/core/equipment.c @@ -109,9 +109,7 @@ bool weightsystem_none(void *_data) bool no_weightsystems(weightsystem_t *ws) { - int i; - - for (i = 0; i < MAX_WEIGHTSYSTEMS; i++) + for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) if (!weightsystem_none(ws + i)) return false; return true; @@ -125,9 +123,7 @@ static bool one_weightsystem_equal(weightsystem_t *ws1, weightsystem_t *ws2) bool weightsystems_equal(weightsystem_t *ws1, weightsystem_t *ws2) { - int i; - - for (i = 0; i < MAX_WEIGHTSYSTEMS; i++) + for (int i = 0; i < MAX_WEIGHTSYSTEMS; i++) if (!one_weightsystem_equal(ws1 + i, ws2 + i)) return false; return true; @@ -227,10 +223,9 @@ void remove_weightsystem(struct dive *dive, int idx) * and if we are tracking gas consumption the pressures need to be reset to start = end = workingpressure */ void reset_cylinders(struct dive *dive, bool track_gas) { - int i; pressure_t decopo2 = {.mbar = prefs.decopo2}; - for (i = 0; i < MAX_CYLINDERS; i++) { + for (int i = 0; i < MAX_CYLINDERS; i++) { cylinder_t *cyl = &dive->cylinder[i]; if (cylinder_none(cyl)) continue;