aboutsummaryrefslogtreecommitdiffstats
path: root/core/trip.c
AgeCommit message (Collapse)Author
2020-10-25cleanup: fix over-eager Coverity warningsGravatar Dirk Hohndel
Technically get_dive() could return a nullptr. The existing code made sure the argument passed to get_dive() was one that always would result in a valid dive pointer being returned. The new code is only slightly less efficient but allows a static code analysis to easily see that we don't derefence NULL pointers here. On some level this change is unnecessary. But it's also not wrong. Fixes CID 354762 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-05-01cleanup: move declaration of utc_mk* functions to new subsurface-time.h headerGravatar Berthold Stoeger
No point in slurping in all of dive.h for translation units that only want to do some time manipulation without ever touching a dive. Don't call the header "time.h", because we don't want to end up in a confusion with the system header of the same name. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-05-01cleanup: move dive_table from dive.h to divelist.hGravatar Berthold Stoeger
This allows us to decouple dive.h and divelist.h, a small step in include disentangling. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2020-04-18debug output: ensure our debug output is captured on AndroidGravatar Dirk Hohndel
I would have bet money that Android used to send stderr to the logcat log, but apparently it doesn't (anymore?). So in order to be able to have a chance to debug weird cloud storage issues on Android, let's do some wholesale replacement of fprintf(stderr,...) with our own version of the INFO macro that we long ago borrowed from libdivecomputer (and rename it to ensure we don't have a conflict there). Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2020-03-10core/trip handling: add helper function to get trip from idGravatar Dirk Hohndel
In the QML code we pass ids around. I had assumed that there already was a reverse lookup function, but I wasn't able to find it. So I added it. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-12-04Selection: move selection functions from divelist.c to selection.cGravatar Berthold Stoeger
Since we now have a selection.c translation unit, put the selection- related functions there. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-10-26Cleanup: fix obvious resource leakGravatar Dirk Hohndel
Found by Coverity. Fixes CID 350084 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2019-09-21Core: add unique id to tripGravatar Berthold Stoeger
To make it easier to pass around trips through QML, give each trip a unique id. The id is generated in alloc_trip() and uses the same function to generate unique dive ids. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-28Import: use TRIP_THRESHOLD when checking for trip-overlapGravatar Berthold Stoeger
When checking for trip-overlap on import, only really overlapping trips have been considered, i.e. when dives had overlapping times. Instead use the TRIP_THRESHOLD so that on download dives are added to the same trip if in a two-days time frame. Reported-by: Miika Turkia <miika.turkia@gmail.com> Reported-by: Dirk Hohndel <dirk@hohndel.org> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: generate clear_*_table() functions by macroGravatar Berthold Stoeger
In analogy to the other table functions, generate these by a macro as well. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
2019-06-19Cleanup: move trip-related functions into own translation unitGravatar Berthold Stoeger
These functions were spread out over dive.c and divelist.c. Move them into their own file to make all this a bit less monolithic. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>