summaryrefslogtreecommitdiffstats
path: root/divesite.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 01:59:16 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-02-12 11:19:27 -0800
commitcd28e88bee085b1f12561764b87a9b8ffc0a8212 (patch)
tree1e4861e7e963c61cf78e27f3b49b9d614174b234 /divesite.c
parentccf833b45cf7cc9f0bc1ddd3220148835062593d (diff)
downloadsubsurface-cd28e88bee085b1f12561764b87a9b8ffc0a8212.tar.gz
Improve helper functions
Sometimes we want to create a dive site just based on a name, sometimes we have both a name and GPS coordinates. Let's make a helper for either case. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'divesite.c')
-rw-r--r--divesite.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/divesite.c b/divesite.c
index 21efaf2e6..c3bb45950 100644
--- a/divesite.c
+++ b/divesite.c
@@ -37,7 +37,17 @@ struct dive_site *alloc_dive_site()
}
/* allocate a new site and add it to the table */
-uint32_t create_dive_site(const char *name, degrees_t latitude, degrees_t longitude)
+uint32_t create_dive_site(const char *name)
+{
+ struct dive_site *ds = alloc_dive_site();
+ ds->uuid = dive_site_getUniqId();
+ ds->name = copy_string(name);
+
+ return ds->uuid;
+}
+
+/* same as before, but with GPS data */
+uint32_t create_dive_site_with_gps(const char *name, degrees_t latitude, degrees_t longitude)
{
struct dive_site *ds = alloc_dive_site();
ds->uuid = dive_site_getUniqId();
@@ -53,7 +63,7 @@ uint32_t dive_site_uuid_by_name(const char *name)
{
uint32_t id = get_dive_site_uuid_by_name(name);
if (id == 0)
- id = create_dive_site(name, (degrees_t){0}, (degrees_t){0});
+ id = create_dive_site(name);
return id;
}