summaryrefslogtreecommitdiffstats
path: root/core/trip.c
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-09-14 19:26:34 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-09-21 16:12:23 -0700
commit067a481b781b09d4f672733550eba987981ea8b6 (patch)
tree0aa57f0046827155d2c6e379501779cef67143ec /core/trip.c
parent356293da7d8b457885beca77e48574dd9c73ad5c (diff)
downloadsubsurface-067a481b781b09d4f672733550eba987981ea8b6.tar.gz
Core: add unique id to trip
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>
Diffstat (limited to 'core/trip.c')
-rw-r--r--core/trip.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/core/trip.c b/core/trip.c
index bc9b1b5a9..c4534fe27 100644
--- a/core/trip.c
+++ b/core/trip.c
@@ -122,7 +122,9 @@ void remove_dive_from_trip(struct dive *dive, struct trip_table *trip_table_arg)
dive_trip_t *alloc_trip(void)
{
- return calloc(1, sizeof(dive_trip_t));
+ dive_trip_t *res = calloc(1, sizeof(dive_trip_t));
+ res->id = dive_getUniqID();
+ return res;
}
/* insert the trip into the trip table */