summaryrefslogtreecommitdiffstats
path: root/core/divelist.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-05-01 13:43:52 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-05-01 09:42:31 -0700
commit95284c026e763482ef581c8b6298012d2c1fd941 (patch)
treeae00ee0920b3e31991cb324d256ac0c97a5027fd /core/divelist.c
parentc13040798c66c5254fbcc921842cd519da05a4c5 (diff)
downloadsubsurface-95284c026e763482ef581c8b6298012d2c1fd941.tar.gz
cleanup: move dive_table from dive.h to divelist.h
This allows us to decouple dive.h and divelist.h, a small step in include disentangling. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/divelist.c')
-rw-r--r--core/divelist.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/divelist.c b/core/divelist.c
index 9328336c6..579886b02 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -1,11 +1,12 @@
// SPDX-License-Identifier: GPL-2.0
/* divelist.c */
+#include "divelist.h"
#include "subsurface-string.h"
#include "deco.h"
#include "device.h"
#include "divesite.h"
-#include "divelist.h"
+#include "dive.h"
#include "fulltext.h"
#include "planner.h"
#include "qthelper.h"
@@ -745,6 +746,13 @@ void delete_dive_from_table(struct dive_table *table, int idx)
remove_from_dive_table(table, idx);
}
+struct dive *get_dive_from_table(int nr, const struct dive_table *dt)
+{
+ if (nr >= dt->nr || nr < 0)
+ return NULL;
+ return dt->dives[nr];
+}
+
/* This removes a dive from the global dive table but doesn't free the
* resources associated with the dive. The caller must removed the dive
* from the trip-list. Returns a pointer to the unregistered dive.