diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/datatrak.c | 1 | ||||
-rw-r--r-- | core/dive.c | 8 | ||||
-rw-r--r-- | core/dive.h | 9 | ||||
-rw-r--r-- | core/divelist.c | 10 | ||||
-rw-r--r-- | core/divelist.h | 12 | ||||
-rw-r--r-- | core/divesite.h | 2 | ||||
-rw-r--r-- | core/file.h | 1 | ||||
-rw-r--r-- | core/gpslocation.cpp | 1 | ||||
-rw-r--r-- | core/libdivecomputer.c | 2 | ||||
-rw-r--r-- | core/liquivision.c | 2 | ||||
-rw-r--r-- | core/load-git.c | 1 | ||||
-rw-r--r-- | core/ostctools.c | 2 | ||||
-rw-r--r-- | core/parse.h | 2 | ||||
-rw-r--r-- | core/planner.c | 3 | ||||
-rw-r--r-- | core/qthelper.cpp | 1 | ||||
-rw-r--r-- | core/save-git.c | 1 | ||||
-rw-r--r-- | core/save-html.c | 1 | ||||
-rw-r--r-- | core/save-xml.c | 1 | ||||
-rw-r--r-- | core/subsurface-qt/diveobjecthelper.cpp | 1 | ||||
-rw-r--r-- | core/trip.c | 1 | ||||
-rw-r--r-- | core/worldmap-save.c | 1 |
21 files changed, 41 insertions, 22 deletions
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" |