From 65f3135a92cb9bb33c9870105334ca458e1f151d Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Fri, 30 May 2014 15:40:13 -0700 Subject: Planner: don't do unnecessary work on empty dive plans Signed-off-by: Dirk Hohndel --- planner.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'planner.c') diff --git a/planner.c b/planner.c index 2cc47258c..405b07e02 100644 --- a/planner.c +++ b/planner.c @@ -49,6 +49,20 @@ void dump_plan(struct diveplan *diveplan) } #endif +bool diveplan_empty(struct diveplan *diveplan) +{ + struct divedatapoint *dp; + if (!diveplan || !diveplan->dp) + return true; + dp = diveplan->dp; + while(dp) { + if (dp->time) + return false; + dp = dp->next; + } + return true; +} + void set_last_stop(bool last_stop_6m) { if (last_stop_6m == true) -- cgit v1.2.3-70-g09d2