aboutsummaryrefslogtreecommitdiffstats
path: root/core/divelist.c
diff options
context:
space:
mode:
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.