Statistics: remove global state / calculate only when needed

Statistics were calculated into global variables every time the
current dive was changed.

Calculate statistics only when needed and into a structure
provided by the caller.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2018-10-06 10:58:12 +02:00 committed by Dirk Hohndel
parent 68fdc0b6f4
commit 97991e2b9f
7 changed files with 141 additions and 107 deletions

View file

@ -49,13 +49,9 @@ int main(int argc, char **argv)
// this should have set up the informational preferences - let's grab
// the units from there
prefs.unit_system = git_prefs.unit_system;
prefs.units = git_prefs.units;
// populate the statistics
process_all_dives();
// now set up the export settings to create the HTML export
struct htmlExportSetting hes;
hes.themeFile = "sand.css";