From f427226b3b605523bc8285dbdaaa7f6993af6e6a Mon Sep 17 00:00:00 2001 From: Berthold Stoeger Date: Sun, 23 Sep 2018 21:22:48 +0200 Subject: Undo: make diverse trip-related operations undo-able AddDivesToTrip, CreateTrip, AutogroupDives, RemoveAutogenTrips and MergeTrips basically all did the same thing as RemoveDivesFromTrip, which was already implemented. Thus, factor our the common functionality and hook it up to make all these functions undo-able. Don't do the autogroup-call everytime the dive-list is rebuilt (that would create innumberable undo-actions), but only on dive-load / import or if expressly asked by the user [by switching the autogroup flag]. Signed-off-by: Berthold Stoeger --- core/parse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'core/parse.c') diff --git a/core/parse.c b/core/parse.c index 46c041925..c8f3ae89a 100644 --- a/core/parse.c +++ b/core/parse.c @@ -282,7 +282,7 @@ void trip_start(void) if (cur_trip) return; dive_end(); - cur_trip = calloc(1, sizeof(dive_trip_t)); + cur_trip = alloc_trip(); memset(&cur_tm, 0, sizeof(cur_tm)); } -- cgit v1.2.3-70-g09d2