From c22fd9f4fd6699333629b8acb1e9c135a9783082 Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Mon, 4 Mar 2019 23:20:29 +0100 Subject: 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 --- core/divelist.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'core/divelist.c') 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 #include -#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) -- cgit v1.2.3-70-g09d2