diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-02-26 21:14:48 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-02-28 07:27:10 -0800 |
commit | 3c2dd7f7c6144a9b586269fcae35fe58a38f037d (patch) | |
tree | fd0c9430625d6b314a69c5170b0b2de3e9df956d | |
parent | 9c87c0dafd5d9946261787bcbb2e6311b5e5f444 (diff) | |
download | subsurface-3c2dd7f7c6144a9b586269fcae35fe58a38f037d.tar.gz |
Cleanup: move get_divesite_idx() to divesite.c
This function was defined in divelist.c, whereas it's better located
in divesite.c. Move it.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | core/divelist.c | 13 | ||||
-rw-r--r-- | core/divelist.h | 1 | ||||
-rw-r--r-- | core/divesite.c | 13 | ||||
-rw-r--r-- | core/divesite.h | 1 |
4 files changed, 14 insertions, 14 deletions
diff --git a/core/divelist.c b/core/divelist.c index a1e6c08bc..6a8f78f0f 100644 --- a/core/divelist.c +++ b/core/divelist.c @@ -512,19 +512,6 @@ int get_divenr(const struct dive *dive) return -1; } -int get_divesite_idx(const struct dive_site *ds) -{ - int i; - const struct dive_site *d; - // tempting as it may be, don't die when called with dive=NULL - if (ds) - for_each_dive_site(i, d) { - if (d->uuid == ds->uuid) // don't compare pointers, we could be passing in a copy of the dive - return i; - } - return -1; -} - static struct gasmix air = { .o2.permille = O2_IN_AIR, .he.permille = 0 }; /* take into account previous dives until there is a 48h gap between dives */ diff --git a/core/divelist.h b/core/divelist.h index ae36de9db..31f92c718 100644 --- a/core/divelist.h +++ b/core/divelist.h @@ -34,7 +34,6 @@ extern int dive_table_get_insertion_index(struct dive_table *table, struct dive extern void add_single_dive(int idx, struct dive *dive); extern void get_dive_gas(const struct dive *dive, int *o2_p, int *he_p, int *o2low_p); extern int get_divenr(const struct dive *dive); -extern int get_divesite_idx(const struct dive_site *ds); extern struct dive_trip *unregister_dive_from_trip(struct dive *dive); extern void remove_dive_from_trip(struct dive *dive, struct trip_table *trip_table); extern dive_trip_t *alloc_trip(void); diff --git a/core/divesite.c b/core/divesite.c index a04d69f23..1ee399168 100644 --- a/core/divesite.c +++ b/core/divesite.c @@ -10,6 +10,19 @@ struct dive_site_table dive_site_table; +int get_divesite_idx(const struct dive_site *ds) +{ + int i; + const struct dive_site *d; + // tempting as it may be, don't die when called with dive=NULL + if (ds) + for_each_dive_site(i, d) { + if (d->uuid == ds->uuid) // don't compare pointers, we could be passing in a copy of the dive + return i; + } + return -1; +} + struct dive_site *get_dive_site_by_uuid(uint32_t uuid) { int i; diff --git a/core/divesite.h b/core/divesite.h index 01c1f82f3..b3ae0657c 100644 --- a/core/divesite.h +++ b/core/divesite.h @@ -42,6 +42,7 @@ static inline struct dive_site *get_dive_site(int nr) #define for_each_dive_site(_i, _x) \ for ((_i) = 0; ((_x) = get_dive_site(_i)) != NULL; (_i)++) +int get_divesite_idx(const struct dive_site *ds); struct dive_site *get_dive_site_by_uuid(uint32_t uuid); void dive_site_table_sort(); struct dive_site *alloc_or_get_dive_site(uint32_t uuid); |