summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--backend-shared/exportfuncs.cpp1
-rw-r--r--commands/command_base.h1
-rw-r--r--core/datatrak.c1
-rw-r--r--core/dive.c8
-rw-r--r--core/dive.h9
-rw-r--r--core/divelist.c10
-rw-r--r--core/divelist.h12
-rw-r--r--core/divesite.h2
-rw-r--r--core/file.h1
-rw-r--r--core/gpslocation.cpp1
-rw-r--r--core/libdivecomputer.c2
-rw-r--r--core/liquivision.c2
-rw-r--r--core/load-git.c1
-rw-r--r--core/ostctools.c2
-rw-r--r--core/parse.h2
-rw-r--r--core/planner.c3
-rw-r--r--core/qthelper.cpp1
-rw-r--r--core/save-git.c1
-rw-r--r--core/save-html.c1
-rw-r--r--core/save-xml.c1
-rw-r--r--core/subsurface-qt/diveobjecthelper.cpp1
-rw-r--r--core/trip.c1
-rw-r--r--core/worldmap-save.c1
-rw-r--r--desktop-widgets/importgps.cpp2
-rw-r--r--desktop-widgets/templatelayout.cpp1
-rw-r--r--qt-models/divepicturemodel.cpp1
-rw-r--r--qt-models/diveplannermodel.cpp1
-rw-r--r--smtk-import/smtk_standalone.cpp1
-rw-r--r--subsurface-mobile-main.cpp1
-rw-r--r--tests/testAirPressure.cpp1
-rw-r--r--tests/testgitstorage.cpp1
-rw-r--r--tests/testmerge.cpp1
-rw-r--r--tests/testpicture.cpp1
-rw-r--r--tests/testrenumber.cpp1
34 files changed, 54 insertions, 23 deletions
diff --git a/backend-shared/exportfuncs.cpp b/backend-shared/exportfuncs.cpp
index 7ae91f2d4..38fd24942 100644
--- a/backend-shared/exportfuncs.cpp
+++ b/backend-shared/exportfuncs.cpp
@@ -3,6 +3,7 @@
#include <QDir>
#include <QtConcurrent>
#include "core/membuffer.h"
+#include "core/dive.h"
#include "core/divesite.h"
#include "core/gettextfromc.h"
#include "core/tag.h"
diff --git a/commands/command_base.h b/commands/command_base.h
index be725d6a5..d805610e5 100644
--- a/commands/command_base.h
+++ b/commands/command_base.h
@@ -6,6 +6,7 @@
#include "core/divesite.h"
#include "core/trip.h"
+#include "core/dive.h"
#include <QUndoCommand>
#include <QCoreApplication> // For Q_DECLARE_TR_FUNCTIONS
diff --git a/core/datatrak.c b/core/datatrak.c
index 2d825cb37..2c7abefba 100644
--- a/core/datatrak.c
+++ b/core/datatrak.c
@@ -16,6 +16,7 @@
#include "device.h"
#include "file.h"
#include "divesite.h"
+#include "dive.h"
#include "errorhelper.h"
#include "ssrf.h"
#include "tag.h"
diff --git a/core/dive.c b/core/dive.c
index c95bc6a95..2073099e2 100644
--- a/core/dive.c
+++ b/core/dive.c
@@ -5,6 +5,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
+#include "dive.h"
#include "gettext.h"
#include "subsurface-string.h"
#include "libdivecomputer.h"
@@ -3921,13 +3922,6 @@ struct dive *get_dive(int nr)
return dive_table.dives[nr];
}
-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];
-}
-
struct dive_site *get_dive_site_for_dive(const struct dive *dive)
{
return dive->dive_site;
diff --git a/core/dive.h b/core/dive.h
index c9369885a..c908750d3 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -128,16 +128,10 @@ struct divecomputer {
struct divecomputer *next;
};
-typedef struct dive_table {
- int nr, allocated;
- struct dive **dives;
-} dive_table_t;
-
-static const dive_table_t empty_dive_table = { 0, 0, (struct dive **)0 };
-
struct picture;
struct dive_site;
struct dive_site_table;
+struct dive_table;
struct dive_trip;
struct trip_table;
struct full_text_cache;
@@ -248,7 +242,6 @@ extern int quit, force_root, ignore_bt;
extern char *testqml;
#endif
-extern struct dive_table dive_table;
extern struct dive displayed_dive;
extern unsigned int dc_number;
extern struct dive *current_dive;
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.
diff --git a/core/divelist.h b/core/divelist.h
index 14366f274..e0c0058ad 100644
--- a/core/divelist.h
+++ b/core/divelist.h
@@ -2,15 +2,25 @@
#ifndef DIVELIST_H
#define DIVELIST_H
-#include "dive.h"
+#include "units.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct dive;
+struct trip_table;
+struct dive_site_table;
struct deco_state;
extern int shown_dives;
+struct dive_table {
+ int nr, allocated;
+ struct dive **dives;
+};
+static const struct dive_table empty_dive_table = { 0, 0, (struct dive **)0 };
+extern struct dive_table dive_table;
+
/* this is used for both git and xml format */
#define DATAFORMAT_VERSION 3
diff --git a/core/divesite.h b/core/divesite.h
index 022d2c0fe..b143ccef6 100644
--- a/core/divesite.h
+++ b/core/divesite.h
@@ -4,7 +4,7 @@
#include "units.h"
#include "taxonomy.h"
-#include "dive.h"
+#include "divelist.h"
#include <stdlib.h>
#ifdef __cplusplus
diff --git a/core/file.h b/core/file.h
index 012d7e727..d184d169a 100644
--- a/core/file.h
+++ b/core/file.h
@@ -3,6 +3,7 @@
#define FILE_H
#include <sys/stat.h>
+#include <stdio.h>
struct memblock {
void *buffer;
diff --git a/core/gpslocation.cpp b/core/gpslocation.cpp
index 0410882ea..feea645e1 100644
--- a/core/gpslocation.cpp
+++ b/core/gpslocation.cpp
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "core/gpslocation.h"
#include "core/divesite.h"
+#include "core/dive.h"
#include "qt-models/gpslistmodel.h"
#include "core/pref.h"
#include "core/qthelper.h"
diff --git a/core/libdivecomputer.c b/core/libdivecomputer.c
index f40c55c2e..88e67e317 100644
--- a/core/libdivecomputer.c
+++ b/core/libdivecomputer.c
@@ -17,7 +17,7 @@
#include "divesite.h"
#include "subsurface-string.h"
#include "device.h"
-#include "divelist.h"
+#include "dive.h"
#include "display.h"
#include "errorhelper.h"
#include "sha1.h"
diff --git a/core/liquivision.c b/core/liquivision.c
index 5a9caf603..c15e88e7a 100644
--- a/core/liquivision.c
+++ b/core/liquivision.c
@@ -3,7 +3,7 @@
#include "ssrf.h"
#include "divesite.h"
-#include "divelist.h"
+#include "dive.h"
#include "file.h"
#include "strndup.h"
diff --git a/core/load-git.c b/core/load-git.c
index 24f96a794..6af1f004f 100644
--- a/core/load-git.c
+++ b/core/load-git.c
@@ -15,6 +15,7 @@
#include "gettext.h"
+#include "dive.h"
#include "divesite.h"
#include "errorhelper.h"
#include "trip.h"
diff --git a/core/ostctools.c b/core/ostctools.c
index c8d7723ce..7efad32d3 100644
--- a/core/ostctools.c
+++ b/core/ostctools.c
@@ -7,7 +7,7 @@
#include "ssrf.h"
#include "subsurface-string.h"
#include "gettext.h"
-#include "divelist.h"
+#include "dive.h"
#include "file.h"
#include "libdivecomputer.h"
diff --git a/core/parse.h b/core/parse.h
index 23b9d5af4..56fbff7b4 100644
--- a/core/parse.h
+++ b/core/parse.h
@@ -4,6 +4,8 @@
#define MAX_EVENT_NAME 128
+#include "dive.h" // for struct event!
+
#include <sqlite3.h>
typedef union {
diff --git a/core/planner.c b/core/planner.c
index f4fb9ee80..5119938f0 100644
--- a/core/planner.c
+++ b/core/planner.c
@@ -10,7 +10,8 @@
#include <ctype.h>
#include <string.h>
#include "ssrf.h"
-#include "divelist.h"
+#include "dive.h"
+#include "divelist.h" // for init_decompression()
#include "subsurface-string.h"
#include "deco.h"
#include "errorhelper.h"
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 4fa92c4e9..6ac539ac1 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "qthelper.h"
+#include "dive.h"
#include "core/settings/qPrefLanguage.h"
#include "core/settings/qPrefUpdateManager.h"
#include "subsurface-string.h"
diff --git a/core/save-git.c b/core/save-git.c
index 5de9c2a63..d6c1814b4 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -17,6 +17,7 @@
#include <fcntl.h>
#include <git2.h>
+#include "dive.h"
#include "divesite.h"
#include "subsurface-string.h"
#include "trip.h"
diff --git a/core/save-html.c b/core/save-html.c
index 82defeed3..894dc70c0 100644
--- a/core/save-html.c
+++ b/core/save-html.c
@@ -5,6 +5,7 @@
#endif
#include "save-html.h"
+#include "dive.h"
#include "qthelper.h"
#include "gettext.h"
#include "divesite.h"
diff --git a/core/save-xml.c b/core/save-xml.c
index c7ef3a7c2..71b2da4b4 100644
--- a/core/save-xml.c
+++ b/core/save-xml.c
@@ -13,6 +13,7 @@
#include <unistd.h>
#include <fcntl.h>
+#include "dive.h"
#include "divesite.h"
#include "errorhelper.h"
#include "subsurface-string.h"
diff --git a/core/subsurface-qt/diveobjecthelper.cpp b/core/subsurface-qt/diveobjecthelper.cpp
index aec5984a8..bed504975 100644
--- a/core/subsurface-qt/diveobjecthelper.cpp
+++ b/core/subsurface-qt/diveobjecthelper.cpp
@@ -4,6 +4,7 @@
#include <QDateTime>
#include <QTextDocument>
+#include "core/dive.h"
#include "core/qthelper.h"
#include "core/divesite.h"
#include "core/trip.h"
diff --git a/core/trip.c b/core/trip.c
index 070d05a21..c35cb0e43 100644
--- a/core/trip.c
+++ b/core/trip.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0
#include "trip.h"
+#include "dive.h"
#include "subsurface-string.h"
#include "selection.h"
#include "table.h"
diff --git a/core/worldmap-save.c b/core/worldmap-save.c
index 121f0f728..61c223442 100644
--- a/core/worldmap-save.c
+++ b/core/worldmap-save.c
@@ -9,6 +9,7 @@
#include <string.h>
#include <stdio.h>
+#include "dive.h"
#include "membuffer.h"
#include "divesite.h"
#include "errorhelper.h"
diff --git a/desktop-widgets/importgps.cpp b/desktop-widgets/importgps.cpp
index 6e36c548a..fa2529883 100644
--- a/desktop-widgets/importgps.cpp
+++ b/desktop-widgets/importgps.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "desktop-widgets/importgps.h"
+#include "core/dive.h" // for utc_mkdate()
/* Import dive coordinates from a GPS device and synchronise them with the dive profile information
of a dive computer. This file contains the infrastructure to:
@@ -152,4 +153,3 @@ void ImportGPS::timeZoneEditChanged()
getCoordsFromGPXFile(&coords, fileName);
updateUI();
}
-
diff --git a/desktop-widgets/templatelayout.cpp b/desktop-widgets/templatelayout.cpp
index 55aabe706..633d4569c 100644
--- a/desktop-widgets/templatelayout.cpp
+++ b/desktop-widgets/templatelayout.cpp
@@ -4,6 +4,7 @@
#include <list>
#include "templatelayout.h"
+#include "core/divelist.h"
#include "core/selection.h"
QList<QString> grantlee_templates, grantlee_statistics_templates;
diff --git a/qt-models/divepicturemodel.cpp b/qt-models/divepicturemodel.cpp
index 705f23592..aab0e7f6f 100644
--- a/qt-models/divepicturemodel.cpp
+++ b/qt-models/divepicturemodel.cpp
@@ -2,6 +2,7 @@
#include "qt-models/divepicturemodel.h"
#include "core/metrics.h"
#include "core/divelist.h" // for mark_divelist_changed()
+#include "core/dive.h"
#include "core/imagedownloader.h"
#include "core/picture.h"
#include "core/qthelper.h"
diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp
index c6821109b..5132df45f 100644
--- a/qt-models/diveplannermodel.cpp
+++ b/qt-models/diveplannermodel.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "diveplannermodel.h"
+#include "core/divelist.h"
#include "core/subsurface-string.h"
#include "qt-models/cylindermodel.h"
#include "core/planner.h"
diff --git a/smtk-import/smtk_standalone.cpp b/smtk-import/smtk_standalone.cpp
index 7092e26d1..2ac4b62b8 100644
--- a/smtk-import/smtk_standalone.cpp
+++ b/smtk-import/smtk_standalone.cpp
@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <stdio.h>
#include "core/dive.h"
+#include "core/divelist.h"
#include "smrtk2ssrfc_window.h"
#include <QApplication>
#include <QDebug>
diff --git a/subsurface-mobile-main.cpp b/subsurface-mobile-main.cpp
index 89319ba31..7cfcd778d 100644
--- a/subsurface-mobile-main.cpp
+++ b/subsurface-mobile-main.cpp
@@ -6,6 +6,7 @@
#include <string.h>
#include <time.h>
+#include "core/dive.h"
#include "core/color.h"
#include "core/downloadfromdcthread.h"
#include "core/qt-gui.h"
diff --git a/tests/testAirPressure.cpp b/tests/testAirPressure.cpp
index f7d63848a..f8144dd7c 100644
--- a/tests/testAirPressure.cpp
+++ b/tests/testAirPressure.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testAirPressure.h"
+#include "core/dive.h"
#include "core/divesite.h"
#include "core/trip.h"
#include "core/file.h"
diff --git a/tests/testgitstorage.cpp b/tests/testgitstorage.cpp
index c5dc612f5..135b0dc3f 100644
--- a/tests/testgitstorage.cpp
+++ b/tests/testgitstorage.cpp
@@ -2,6 +2,7 @@
#include "testgitstorage.h"
#include "git2.h"
+#include "core/dive.h"
#include "core/divesite.h"
#include "core/file.h"
#include "core/qthelper.h"
diff --git a/tests/testmerge.cpp b/tests/testmerge.cpp
index f57f85429..7fa18756c 100644
--- a/tests/testmerge.cpp
+++ b/tests/testmerge.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testmerge.h"
+#include "core/dive.h" // for save_dives()
#include "core/divesite.h"
#include "core/file.h"
#include "core/trip.h"
diff --git a/tests/testpicture.cpp b/tests/testpicture.cpp
index 08922b1aa..da8fedeec 100644
--- a/tests/testpicture.cpp
+++ b/tests/testpicture.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testpicture.h"
+#include "core/dive.h"
#include "core/divesite.h"
#include "core/errorhelper.h"
#include "core/picture.h"
diff --git a/tests/testrenumber.cpp b/tests/testrenumber.cpp
index 53da23f65..abb0058c1 100644
--- a/tests/testrenumber.cpp
+++ b/tests/testrenumber.cpp
@@ -1,5 +1,6 @@
// SPDX-License-Identifier: GPL-2.0
#include "testrenumber.h"
+#include "core/dive.h"
#include "core/divesite.h"
#include "core/trip.h"
#include "core/file.h"