From 5be01b04ed426579aa9902b7d0c97a6b9bf80010 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sat, 27 Aug 2022 16:36:45 +0200 Subject: [PATCH] cleanup: remove unused function The last caller of find_cylinder_index() was removed in 3629a87fcc. Also remove functions that where only called by this function. Signed-off-by: Berthold Stoeger --- commands/command_edit.cpp | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/commands/command_edit.cpp b/commands/command_edit.cpp index 8de9ddc63..250acd8de 100644 --- a/commands/command_edit.cpp +++ b/commands/command_edit.cpp @@ -1177,35 +1177,12 @@ static bool same_cylinder_size(const cylinder_t &cyl1, const cylinder_t &cyl2) cyl1.type.workingpressure.mbar == cyl2.type.workingpressure.mbar; } -static bool same_cylinder_pressure(const cylinder_t &cyl1, const cylinder_t &cyl2) -{ - return cyl1.start.mbar == cyl2.start.mbar && - cyl1.end.mbar == cyl2.end.mbar; -} - // Flags for comparing cylinders static constexpr int SAME_TYPE = 1 << 0; static constexpr int SAME_SIZE = 1 << 1; static constexpr int SAME_PRESS = 1 << 2; static constexpr int SAME_GAS = 1 << 3; -static bool same_cylinder_with_flags(const cylinder_t &cyl1, const cylinder_t &cyl2, int sameCylinderFlags) -{ - return (((sameCylinderFlags & SAME_TYPE) == 0 || same_cylinder_type(cyl1, cyl2)) && - ((sameCylinderFlags & SAME_SIZE) == 0 || same_cylinder_size(cyl1, cyl2)) && - ((sameCylinderFlags & SAME_PRESS) == 0 || same_cylinder_pressure(cyl1, cyl2)) && - ((sameCylinderFlags & SAME_GAS) == 0 || same_gasmix(cyl1.gasmix, cyl2.gasmix))); -} - -static int find_cylinder_index(const struct dive *d, const cylinder_t &cyl, int sameCylinderFlags) -{ - for (int idx = 0; idx < d->cylinders.nr; ++idx) { - if (same_cylinder_with_flags(cyl, *get_cylinder(d, idx), sameCylinderFlags)) - return idx; - } - return -1; -} - EditCylinderBase::EditCylinderBase(int index, bool currentDiveOnly, bool nonProtectedOnly, int sameCylinderFlags) : EditDivesBase(currentDiveOnly) {