mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
cleanup: consistently use get_cylinder() accessor
get_cylinder(d, i) is more readable than d->cylinders.cylinders[i]. Moreover, it does bound checking and is more flexible with respect to changing the core data structures. Most places already used this accessor, but some still accessed the cylinders directly. This patch unifies the accesses by consistently switching to get_cylinder(). The affected code is in C++ and accesses the cylinder as reference or object, whereas the get_cylinder() function is C and returns a pointer. This results in funky looking "*get_cylinder(d, i)" expressions. Arguably still better than the original. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
efc1b4f31a
commit
fe3021b88a
4 changed files with 9 additions and 9 deletions
|
@ -127,7 +127,7 @@ static std::vector<QString> getWords(const dive *d)
|
|||
for (const tag_entry *tag = d->tag_list; tag; tag = tag->next)
|
||||
tokenize(QString(tag->tag->name), res);
|
||||
for (int i = 0; i < d->cylinders.nr; ++i) {
|
||||
const cylinder_t &cyl = d->cylinders.cylinders[i];
|
||||
const cylinder_t &cyl = *get_cylinder(d, i);
|
||||
tokenize(QString(cyl.type.description), res);
|
||||
}
|
||||
for (int i = 0; i < d->weightsystems.nr; ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue