summaryrefslogtreecommitdiffstats
path: root/core/dive.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2018-11-24 12:31:35 +0100
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-01-09 20:58:04 -0800
commit517fb7a462c207e32cc7c5ed50e1e9b1f359dbd8 (patch)
tree2ce9dd590f60743f5f565af320ea77c474c2e1c4 /core/dive.h
parent54fcda4c32029c1afd9eb02fb0c4a5e1949da175 (diff)
downloadsubsurface-517fb7a462c207e32cc7c5ed50e1e9b1f359dbd8.tar.gz
Core: keep trips in table(s)
Currently, all trips are kept in a linked list. Replace the list by a table in analogy to dive_table. Use this to keep the trip_table sorted as suggested by dump_trip_list(). When inserting a trip into the table do that after adding the dives, to avoid warnings coming out of dump_trip_list(). Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/dive.h')
-rw-r--r--core/dive.h10
1 files changed, 7 insertions, 3 deletions
diff --git a/core/dive.h b/core/dive.h
index a6210810d..d0666f724 100644
--- a/core/dive.h
+++ b/core/dive.h
@@ -286,11 +286,13 @@ typedef struct dive_trip
/* Used by the io-routines to mark trips that have already been written. */
bool saved;
bool autogen;
- struct dive_trip *next;
} dive_trip_t;
-/* List of dive trips (sorted by date) */
-extern dive_trip_t *dive_trip_list;
+struct trip_table {
+ int nr, allocated;
+ struct dive_trip **trips;
+};
+
struct picture;
struct dive {
int number;
@@ -420,6 +422,7 @@ extern const struct units *get_units(void);
extern int run_survey, verbose, quit, force_root;
extern struct dive_table dive_table;
+extern struct trip_table trip_table;
extern struct dive displayed_dive;
extern unsigned int dc_number;
extern struct dive *current_dive;
@@ -543,6 +546,7 @@ extern bool dive_less_than(const struct dive *a, const struct dive *b);
extern bool trip_less_than(const struct dive_trip *a, const struct dive_trip *b);
extern bool dive_or_trip_less_than(struct dive_or_trip a, struct dive_or_trip b);
extern void sort_dive_table(struct dive_table *table);
+extern void sort_trip_table(struct trip_table *table);
extern struct dive *fixup_dive(struct dive *dive);
extern void fixup_dc_duration(struct divecomputer *dc);
extern int dive_getUniqID();