summaryrefslogtreecommitdiffstats
path: root/core/save-git.c
diff options
context:
space:
mode:
authorGravatar Linus Torvalds <torvalds@linux-foundation.org>2018-10-20 14:12:15 -0400
committerGravatar Lubomir I. Ivanov <neolit123@gmail.com>2018-10-21 19:55:09 +0300
commit28e3413ff66552f392fecee25068d634cdfe59fc (patch)
tree5fe303d1e7dc1c371e13b534b85c232e29aea884 /core/save-git.c
parentc9869406301ff72f76b399097f0845fc1102ced1 (diff)
downloadsubsurface-28e3413ff66552f392fecee25068d634cdfe59fc.tar.gz
Add 'location_t' data structure
Instead of having people treat latitude and longitude as separate things, just add a 'location_t' data structure that contains both. Almost all cases want to always act on them together. This is really just prep-work for adding a few more locations that we track: I want to add a entry/exit location to each dive (independent of the dive site) because of how the Garmin Descent gives us the information (and hopefully, some day, other dive computers too). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'core/save-git.c')
-rw-r--r--core/save-git.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/core/save-git.c b/core/save-git.c
index 7db47dc94..938b7d3a5 100644
--- a/core/save-git.c
+++ b/core/save-git.c
@@ -38,14 +38,6 @@ static void cond_put_format(int cond, struct membuffer *b, const char *fmt, ...)
#define SAVE(str, x) cond_put_format(dive->x, b, str " %d\n", dive->x)
-static void show_gps(struct membuffer *b, degrees_t latitude, degrees_t longitude)
-{
- if (latitude.udeg || longitude.udeg) {
- put_degrees(b, latitude, "gps ", " ");
- put_degrees(b, longitude, "", "\n");
- }
-}
-
static void quote(struct membuffer *b, const char *text)
{
const char *p = text;
@@ -613,7 +605,7 @@ static int save_one_picture(git_repository *repo, struct dir *dir, struct pictur
unsigned h;
show_utf8(&buf, "filename ", pic->filename, "\n");
- show_gps(&buf, pic->latitude, pic->longitude);
+ put_location(&buf, &pic->location, "gps ", "\n");
/* Picture loading will load even negative offsets.. */
if (offset < 0) {
@@ -921,7 +913,7 @@ static void save_divesites(git_repository *repo, struct dir *tree)
show_utf8(&b, "name ", ds->name, "\n");
show_utf8(&b, "description ", ds->description, "\n");
show_utf8(&b, "notes ", ds->notes, "\n");
- show_gps(&b, ds->latitude, ds->longitude);
+ put_location(&b, &ds->location, "gps ", "\n");
for (int j = 0; j < ds->taxonomy.nr; j++) {
struct taxonomy *t = &ds->taxonomy.category[j];
if (t->category != TC_NONE && t->value) {