summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-03-04 23:20:29 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-04-12 18:19:07 +0300
commitc22fd9f4fd6699333629b8acb1e9c135a9783082 (patch)
tree7fad8249eb4fb3fa2797329716b1038d115a62d9
parentf2cdca7bccfcdfa04639600689b2b13b38b56898 (diff)
downloadsubsurface-c22fd9f4fd6699333629b8acb1e9c135a9783082.tar.gz
Dive sites: prepare for dive site ref-counting
Add a dive site table to each dive site to keep track of dives that have been added to a dive site. Add two functions to add dives to / remove dives from dive sites. Since dive sites now contain a dive table, the order of includes had to be changed: "divesite.h" now includes "dive.h" and not vice-versa. This caused some include churn. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--core/datatrak.c1
-rw-r--r--core/dive.c1
-rw-r--r--core/dive.h7
-rw-r--r--core/divelist.c6
-rw-r--r--core/divelist.h6
-rw-r--r--core/divesite.c23
-rw-r--r--core/divesite.h7
-rw-r--r--core/downloadfromdcthread.h2
-rw-r--r--core/gpslocation.cpp1
-rw-r--r--core/import-cobalt.c2
-rw-r--r--core/import-divinglog.c2
-rw-r--r--core/libdivecomputer.c2
-rw-r--r--core/liquivision.c2
-rw-r--r--core/load-git.c2
-rw-r--r--core/parse-xml.c2
-rw-r--r--core/parse.c2
-rw-r--r--core/save-git.c2
-rw-r--r--core/save-html.c3
-rw-r--r--core/save-xml.c2
-rw-r--r--core/subsurface-qt/DiveObjectHelper.cpp1
-rw-r--r--core/uemis-downloader.c1
-rw-r--r--core/uemis.c1
-rw-r--r--core/worldmap-save.c1
-rw-r--r--desktop-widgets/command_base.h2
-rw-r--r--desktop-widgets/divelogexportdialog.cpp2
-rw-r--r--desktop-widgets/divelogimportdialog.cpp1
-rw-r--r--desktop-widgets/modeldelegates.cpp1
-rw-r--r--desktop-widgets/simplewidgets.cpp1
-rw-r--r--qt-models/diveimportedmodel.h2
-rw-r--r--qt-models/divelocationmodel.cpp1
-rw-r--r--qt-models/filtermodels.cpp1
-rw-r--r--tests/testgitstorage.cpp2
-rw-r--r--tests/testmerge.cpp2
-rw-r--r--tests/testparse.cpp2
-rw-r--r--tests/testparseperformance.cpp2
-rw-r--r--tests/testpicture.cpp2
-rw-r--r--tests/testprofile.cpp2
-rw-r--r--tests/testrenumber.cpp2
38 files changed, 75 insertions, 29 deletions
diff --git a/core/datatrak.c b/core/datatrak.c
index fa5f3cbcd..0f7886158 100644
--- a/core/datatrak.c
+++ b/core/datatrak.c
@@ -15,6 +15,7 @@
#include "units.h"
#include "device.h"
#include "file.h"
+#include "divesite.h"
#include "ssrf.h"
static unsigned int two_bytes_to_int(unsigned char x, unsigned char y)
diff --git a/core/dive.c b/core/dive.c
index bd7181361..b05030c60 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -10,6 +10,7 @@
#include "libdivecomputer.h"
#include "device.h"
#include "divelist.h"
+#include "divesite.h"
#include "qthelper.h"
#include "metadata.h"
#include "membuffer.h"
diff --git a/core/dive.h b/core/dive.h
index fd03bc4ae..7c41f6c73 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -12,7 +12,6 @@
#include <zip.h>
#include <string.h>
#include <sys/stat.h>
-#include "divesite.h"
#include "units.h"
@@ -289,6 +288,8 @@ typedef struct trip_table {
} trip_table_t;
struct picture;
+struct dive_site;
+struct dive_site_table;
struct dive {
int number;
bool notrip; /* Don't autogroup this dive to a trip */
@@ -747,12 +748,12 @@ extern void average_max_depth(struct diveplan *dive, int *avg_depth, int *max_de
* Note: we have to use the typedef "dive_table_t" instead of "struct dive_table",
* because MOC removes the "struct", but dive_table is already the name of a global
* variable, leading to compilation errors. Likewise for "struct trip_table" and
- * "struct dive_site_table". */
+ * "struct dive_site_table" (defined in "divesite.h"). */
+#include <QObject>
Q_DECLARE_METATYPE(struct dive *);
Q_DECLARE_METATYPE(struct dive_trip *);
Q_DECLARE_METATYPE(dive_table_t *);
Q_DECLARE_METATYPE(trip_table_t *);
-Q_DECLARE_METATYPE(dive_site_table_t *);
#endif
diff --git a/core/divelist.c b/core/divelist.c
index 09f08acd0..67a71ca14 100644
--- a/core/divelist.c
+++ b/core/divelist.c
@@ -12,8 +12,8 @@
#include <zip.h>
#include <libxslt/transform.h>
-#include "dive.h"
#include "subsurface-string.h"
+#include "divesite.h"
#include "divelist.h"
#include "display.h"
#include "planner.h"
@@ -872,7 +872,7 @@ static MAKE_GET_INSERTION_INDEX(trip_table, struct dive_trip *, trips, trip_less
} \
}
-static MAKE_ADD_TO(dive_table, struct dive *, dives)
+MAKE_ADD_TO(dive_table, struct dive *, dives)
static MAKE_ADD_TO(trip_table, struct dive_trip *, trips)
#define MAKE_REMOVE_FROM(table_type, array_name) \
@@ -916,7 +916,7 @@ static MAKE_GET_IDX(trip_table, struct dive_trip *, trips)
MAKE_SORT(dive_table, struct dive *, dives, comp_dives)
MAKE_SORT(trip_table, struct dive_trip *, trips, comp_trips)
-static void remove_dive(struct dive_table *table, const struct dive *dive)
+void remove_dive(struct dive_table *table, const struct dive *dive)
{
int idx = get_idx_in_dive_table(table, dive);
if (idx >= 0)
diff --git a/core/divelist.h b/core/divelist.h
index 1880856df..831d5a3c1 100644
--- a/core/divelist.h
+++ b/core/divelist.h
@@ -2,6 +2,8 @@
#ifndef DIVELIST_H
#define DIVELIST_H
+#include "dive.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -9,8 +11,6 @@ extern "C" {
/* this is used for both git and xml format */
#define DATAFORMAT_VERSION 3
-struct dive;
-
extern void update_cylinder_related_info(struct dive *);
extern void mark_divelist_changed(bool);
extern int unsaved_changes(void);
@@ -33,10 +33,12 @@ extern char *get_dive_gas_string(const struct dive *dive);
extern struct dive **grow_dive_table(struct dive_table *table);
extern int dive_table_get_insertion_index(struct dive_table *table, struct dive *dive);
+extern void add_to_dive_table(struct dive_table *table, int idx, struct dive *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 struct dive_trip *unregister_dive_from_trip(struct dive *dive);
+extern void remove_dive(struct dive_table *table, const struct dive *dive);
extern void remove_dive_from_trip(struct dive *dive, struct trip_table *trip_table_arg);
extern dive_trip_t *alloc_trip(void);
extern dive_trip_t *create_trip_from_dive(struct dive *dive);
diff --git a/core/divesite.c b/core/divesite.c
index a71780faf..d53b72b4b 100644
--- a/core/divesite.c
+++ b/core/divesite.c
@@ -382,6 +382,29 @@ void purge_empty_dive_sites(struct dive_site_table *ds_table)
}
}
+void add_dive_to_dive_site(struct dive *d, struct dive_site *ds)
+{
+ int idx;
+ if (d->dive_site == ds)
+ return;
+ if (d->dive_site)
+ fprintf(stderr, "Warning: adding dive that already belongs to a dive site to a different site\n");
+ idx = dive_table_get_insertion_index(&ds->dives, d);
+ add_to_dive_table(&ds->dives, idx, d);
+ d->dive_site = ds;
+}
+
+struct dive_site *unregister_dive_from_dive_site(struct dive *d)
+{
+ struct dive_site *ds = d->dive_site;
+ if (!ds)
+ return NULL;
+ remove_dive(&ds->dives, d);
+ d->dive_site = NULL;
+ return ds;
+}
+
+/* Assign arbitrary UUIDs to dive sites. This is called by before writing the dive log to XML or git. */
static int compare_sites(const void *_a, const void *_b)
{
const struct dive_site *a = (const struct dive_site *)*(void **)_a;
diff --git a/core/divesite.h b/core/divesite.h
index 09e86bb8c..2210aced1 100644
--- a/core/divesite.h
+++ b/core/divesite.h
@@ -4,6 +4,7 @@
#include "units.h"
#include "taxonomy.h"
+#include "dive.h"
#include <stdlib.h>
#ifdef __cplusplus
@@ -18,6 +19,7 @@ struct dive_site
{
uint32_t uuid;
char *name;
+ struct dive_table dives;
location_t location;
char *description;
char *notes;
@@ -54,6 +56,8 @@ struct dive_site *alloc_dive_site();
int nr_of_dives_at_dive_site(struct dive_site *ds, bool select_only);
bool is_dive_site_used(struct dive_site *ds, bool select_only);
void free_dive_site(struct dive_site *ds);
+void unregister_dive_site(struct dive_site *ds);
+void register_dive_site(struct dive_site *ds);
void delete_dive_site(struct dive_site *ds, struct dive_site_table *ds_table);
struct dive_site *create_dive_site(const char *name, struct dive_site_table *ds_table);
struct dive_site *create_dive_site_with_gps(const char *name, const location_t *, struct dive_site_table *ds_table);
@@ -71,6 +75,8 @@ struct dive_site *find_or_create_dive_site_with_name(const char *name, struct di
void merge_dive_sites(struct dive_site *ref, struct dive_site *dive_sites[], int count);
void purge_empty_dive_sites(struct dive_site_table *ds_table);
void clear_dive_site_table(struct dive_site_table *ds_table);
+void add_dive_to_dive_site(struct dive *d, struct dive_site *ds);
+struct dive_site *unregister_dive_from_dive_site(struct dive *d);
#ifdef __cplusplus
}
@@ -78,6 +84,7 @@ QString constructLocationTags(struct taxonomy_data *taxonomy, bool for_maintab);
/* Make pointer-to-dive_site a "Qt metatype" so that we can pass it through QVariants */
Q_DECLARE_METATYPE(dive_site *);
+Q_DECLARE_METATYPE(dive_site_table_t *);
#endif
diff --git a/core/downloadfromdcthread.h b/core/downloadfromdcthread.h
index d14a5402b..a5cf84073 100644
--- a/core/downloadfromdcthread.h
+++ b/core/downloadfromdcthread.h
@@ -6,7 +6,7 @@
#include <QHash>
#include <QLoggingCategory>
-#include "dive.h"
+#include "divesite.h"
#include "libdivecomputer.h"
#include "connectionlistmodel.h"
#if BT_SUPPORT
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp
index 8a2719a8b..188cfd81c 100644
--- a/core/gpslocation.cpp
+++ b/core/gpslocation.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "core/gpslocation.h"
+#include "core/divesite.h"
#include "qt-models/gpslistmodel.h"
#include "core/pref.h"
#include "core/qthelper.h"
diff --git a/core/import-cobalt.c b/core/import-cobalt.c
index ce5048244..a51d4b9fa 100644
--- a/core/import-cobalt.c
+++ b/core/import-cobalt.c
@@ -5,7 +5,7 @@
#endif
#include "ssrf.h"
-#include "dive.h"
+#include "divesite.h"
#include "subsurface-string.h"
#include "parse.h"
#include "divelist.h"
diff --git a/core/import-divinglog.c b/core/import-divinglog.c
index 7716ddf8e..4f2b1e932 100644
--- a/core/import-divinglog.c
+++ b/core/import-divinglog.c
@@ -5,7 +5,7 @@
#endif
#include "ssrf.h"
-#include "dive.h"
+#include "divesite.h"
#include "subsurface-string.h"
#include "parse.h"
#include "divelist.h"
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index 9a2991bc3..5519afe46 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -14,7 +14,7 @@
#include <fcntl.h>
#include <time.h>
#include "gettext.h"
-#include "dive.h"
+#include "divesite.h"
#include "subsurface-string.h"
#include "device.h"
#include "divelist.h"
diff --git a/core/liquivision.c b/core/liquivision.c
index bfe970e15..621a921be 100644
--- a/core/liquivision.c
+++ b/core/liquivision.c
@@ -2,7 +2,7 @@
#include <string.h>
#include "ssrf.h"
-#include "dive.h"
+#include "divesite.h"
#include "divelist.h"
#include "file.h"
#include "strndup.h"
diff --git a/core/load-git.c b/core/load-git.c
index 5ed6ca07d..84af37196 100644
--- a/core/load-git.c
+++ b/core/load-git.c
@@ -15,7 +15,7 @@
#include "gettext.h"
-#include "dive.h"
+#include "divesite.h"
#include "subsurface-string.h"
#include "divelist.h"
#include "device.h"
diff --git a/core/parse-xml.c b/core/parse-xml.c
index fb2982986..99aef7904 100644
--- a/core/parse-xml.c
+++ b/core/parse-xml.c
@@ -22,7 +22,7 @@
#include "gettext.h"
-#include "dive.h"
+#include "divesite.h"
#include "subsurface-string.h"
#include "parse.h"
#include "divelist.h"
diff --git a/core/parse.c b/core/parse.c
index 5dceef0f9..87d2b8ea3 100644
--- a/core/parse.c
+++ b/core/parse.c
@@ -7,7 +7,7 @@
#include <unistd.h>
#include <libdivecomputer/parser.h>
-#include "dive.h"
+#include "divesite.h"
#include "subsurface-string.h"
#include "parse.h"
#include "divelist.h"
diff --git a/core/save-git.c b/core/save-git.c
index ce4f52f5e..13d0b4870 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -17,7 +17,7 @@
#include <fcntl.h>
#include <git2.h>
-#include "dive.h"
+#include "divesite.h"
#include "subsurface-string.h"
#include "divelist.h"
#include "device.h"
diff --git a/core/save-html.c b/core/save-html.c
index aeb74bf95..f9d7049a9 100644
--- a/core/save-html.c
+++ b/core/save-html.c
@@ -7,7 +7,8 @@
#include "save-html.h"
#include "qthelper.h"
#include "gettext.h"
-#include "stdio.h"
+#include "divesite.h"
+#include <stdio.h>
void write_attribute(struct membuffer *b, const char *att_name, const char *value, const char *separator)
{
diff --git a/core/save-xml.c b/core/save-xml.c
index 7df5d3de0..93dfc7f85 100644
--- a/core/save-xml.c
+++ b/core/save-xml.c
@@ -13,7 +13,7 @@
#include <unistd.h>
#include <fcntl.h>
-#include "dive.h"
+#include "divesite.h"
#include "subsurface-string.h"
#include "divelist.h"
#include "device.h"
diff --git a/core/subsurface-qt/DiveObjectHelper.cpp b/core/subsurface-qt/DiveObjectHelper.cpp
index e126298ac..da664a1ce 100644
--- a/core/subsurface-qt/DiveObjectHelper.cpp
+++ b/core/subsurface-qt/DiveObjectHelper.cpp
@@ -5,6 +5,7 @@
#include <QTextDocument>
#include "core/qthelper.h"
+#include "core/divesite.h"
#include "core/subsurface-string.h"
#include "qt-models/tankinfomodel.h"
diff --git a/core/uemis-downloader.c b/core/uemis-downloader.c
index 56617a0ae..76e6dcf09 100644
--- a/core/uemis-downloader.c
+++ b/core/uemis-downloader.c
@@ -25,6 +25,7 @@
#include "libdivecomputer.h"
#include "uemis.h"
#include "divelist.h"
+#include "divesite.h"
#include "core/subsurface-string.h"
#define ERR_FS_ALMOST_FULL QT_TRANSLATE_NOOP("gettextFromC", "Uemis Zurich: the file system is almost full.\nDisconnect/reconnect the dive computer\nand click \'Retry\'")
diff --git a/core/uemis.c b/core/uemis.c
index a5b07a8e8..88f402400 100644
--- a/core/uemis.c
+++ b/core/uemis.c
@@ -13,6 +13,7 @@
#include "gettext.h"
#include "uemis.h"
+#include "divesite.h"
#include <libdivecomputer/parser.h>
#include <libdivecomputer/version.h>
diff --git a/core/worldmap-save.c b/core/worldmap-save.c
index c12d27de2..27e31f482 100644
--- a/core/worldmap-save.c
+++ b/core/worldmap-save.c
@@ -10,6 +10,7 @@
#include <stdio.h>
#include "membuffer.h"
+#include "divesite.h"
#include "save-html.h"
#include "worldmap-save.h"
#include "worldmap-options.h"
diff --git a/desktop-widgets/command_base.h b/desktop-widgets/command_base.h
index fbcc61f73..26744dc87 100644
--- a/desktop-widgets/command_base.h
+++ b/desktop-widgets/command_base.h
@@ -4,7 +4,7 @@
#ifndef COMMAND_BASE_H
#define COMMAND_BASE_H
-#include "core/dive.h"
+#include "core/divesite.h"
#include <QUndoCommand>
#include <QCoreApplication> // For Q_DECLARE_TR_FUNCTIONS
diff --git a/desktop-widgets/divelogexportdialog.cpp b/desktop-widgets/divelogexportdialog.cpp
index 216a296eb..87f2e5597 100644
--- a/desktop-widgets/divelogexportdialog.cpp
+++ b/desktop-widgets/divelogexportdialog.cpp
@@ -16,7 +16,7 @@
#include "desktop-widgets/mainwindow.h"
#include "profile-widget/profilewidget2.h"
#include "core/save-profiledata.h"
-#include "core/dive.h" // Allows access to helper functions in TeX export.
+#include "core/divesite.h"
// Retrieves the current unit settings defined in the Subsurface preferences.
#define GET_UNIT(name, field, f, t) \
diff --git a/desktop-widgets/divelogimportdialog.cpp b/desktop-widgets/divelogimportdialog.cpp
index 0bbb0dcb5..a6242ec8d 100644
--- a/desktop-widgets/divelogimportdialog.cpp
+++ b/desktop-widgets/divelogimportdialog.cpp
@@ -11,6 +11,7 @@
#include <QUndoStack>
#include <QPainter>
#include "core/qthelper.h"
+#include "core/divesite.h"
#include "core/import-csv.h"
static QString subsurface_mimedata = "subsurface/csvcolumns";
diff --git a/desktop-widgets/modeldelegates.cpp b/desktop-widgets/modeldelegates.cpp
index fd6bb2e47..b4dfd1e51 100644
--- a/desktop-widgets/modeldelegates.cpp
+++ b/desktop-widgets/modeldelegates.cpp
@@ -14,6 +14,7 @@
#include "qt-models/divetripmodel.h"
#include "qt-models/divelocationmodel.h"
#include "core/qthelper.h"
+#include "core/divesite.h"
#include "desktop-widgets/simplewidgets.h"
#include <QCompleter>
diff --git a/desktop-widgets/simplewidgets.cpp b/desktop-widgets/simplewidgets.cpp
index befea5e32..abaf5b372 100644
--- a/desktop-widgets/simplewidgets.cpp
+++ b/desktop-widgets/simplewidgets.cpp
@@ -13,6 +13,7 @@
#include <QClipboard>
#include "core/file.h"
+#include "core/divesite.h"
#include "desktop-widgets/mainwindow.h"
#include "core/qthelper.h"
#include "libdivecomputer/parser.h"
diff --git a/qt-models/diveimportedmodel.h b/qt-models/diveimportedmodel.h
index 8b0038478..532f5b899 100644
--- a/qt-models/diveimportedmodel.h
+++ b/qt-models/diveimportedmodel.h
@@ -3,7 +3,7 @@
#include <QAbstractTableModel>
#include <vector>
-#include "core/dive.h"
+#include "core/divesite.h"
class DiveImportedModel : public QAbstractTableModel
{
diff --git a/qt-models/divelocationmodel.cpp b/qt-models/divelocationmodel.cpp
index 552c7c276..2ce2e0a3e 100644
--- a/qt-models/divelocationmodel.cpp
+++ b/qt-models/divelocationmodel.cpp
@@ -2,6 +2,7 @@
#include "core/units.h"
#include "qt-models/divelocationmodel.h"
#include "core/qthelper.h"
+#include "core/divesite.h"
#include <QDebug>
#include <QLineEdit>
#include <QIcon>
diff --git a/qt-models/filtermodels.cpp b/qt-models/filtermodels.cpp
index a5ba07204..5fd9ed1f7 100644
--- a/qt-models/filtermodels.cpp
+++ b/qt-models/filtermodels.cpp
@@ -3,6 +3,7 @@
#include "qt-models/models.h"
#include "core/display.h"
#include "core/qthelper.h"
+#include "core/divesite.h"
#include "core/subsurface-string.h"
#include "core/subsurface-qt/DiveListNotifier.h"
#include "qt-models/divetripmodel.h"
diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp
index e4b22a713..16b954cf1 100644
--- a/tests/testgitstorage.cpp
+++ b/tests/testgitstorage.cpp
@@ -2,7 +2,7 @@
#include "testgitstorage.h"
#include "git2.h"
-#include "core/dive.h"
+#include "core/divesite.h"
#include "core/divelist.h"
#include "core/file.h"
#include "core/qthelper.h"
diff --git a/tests/testmerge.cpp b/tests/testmerge.cpp
index c8a103c82..739e7014d 100644
--- a/tests/testmerge.cpp
+++ b/tests/testmerge.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testmerge.h"
-#include "core/dive.h"
+#include "core/divesite.h"
#include "core/divelist.h"
#include "core/file.h"
#include <QTextStream>
diff --git a/tests/testparse.cpp b/tests/testparse.cpp
index 0a751cf11..8318eb137 100644
--- a/tests/testparse.cpp
+++ b/tests/testparse.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testparse.h"
-#include "core/dive.h"
+#include "core/divesite.h"
#include "core/divelist.h"
#include "core/file.h"
#include "core/import-csv.h"
diff --git a/tests/testparseperformance.cpp b/tests/testparseperformance.cpp
index 37393f515..099b41c42 100644
--- a/tests/testparseperformance.cpp
+++ b/tests/testparseperformance.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testparseperformance.h"
-#include "core/dive.h"
+#include "core/divesite.h"
#include "core/divelist.h"
#include "core/file.h"
#include "core/git-access.h"
diff --git a/tests/testpicture.cpp b/tests/testpicture.cpp
index 0e369b937..a9aafa365 100644
--- a/tests/testpicture.cpp
+++ b/tests/testpicture.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testpicture.h"
-#include "core/dive.h"
+#include "core/divesite.h"
#include "core/divelist.h"
#include "core/file.h"
#include <QString>
diff --git a/tests/testprofile.cpp b/tests/testprofile.cpp
index c35312123..f64848e46 100644
--- a/tests/testprofile.cpp
+++ b/tests/testprofile.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testprofile.h"
-#include "core/dive.h"
+#include "core/divesite.h"
#include "core/file.h"
void TestProfile::testRedCeiling()
diff --git a/tests/testrenumber.cpp b/tests/testrenumber.cpp
index 71f4e2952..2eb17f9be 100644
--- a/tests/testrenumber.cpp
+++ b/tests/testrenumber.cpp
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testrenumber.h"
-#include "core/dive.h"
+#include "core/divesite.h"
#include "core/divelist.h"
#include "core/file.h"
#include <QTextStream>