summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Stefan Fuchs <sfuchs@gmx.de>2017-11-27 20:37:19 +0100
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2017-11-27 22:40:16 +0100
commit8d2bc595c73f4a08ea80ddc661c99c6bb2c55358 (patch)
tree0c2bfd9a25601a4ebacdabe2ee8b064ed61a3063
parent07bd8e6455c7ad4c40f00adebb8d7e9cfc316fb4 (diff)
downloadsubsurface-8d2bc595c73f4a08ea80ddc661c99c6bb2c55358.tar.gz
Code cleanup: Move index declarations into for loop
Signed-off-by: Stefan Fuchs <sfuchs@gmx.de>
-rw-r--r--core/equipment.c11
1 files 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;