diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-11-11 13:09:51 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-11-18 16:50:09 -0800 |
commit | 64e6e435f82801f4f440ef5b1caf58a91a7c9929 (patch) | |
tree | 0f2c662daab035463de05c1564af7026c7edbd7e /core/load-git.c | |
parent | 431b2bb84542d4f45952b48aa91231f979762e00 (diff) | |
download | subsurface-64e6e435f82801f4f440ef5b1caf58a91a7c9929.tar.gz |
Core: remove "when" field of struct dive_trip
The when field gives the time of the first dive. Instead of keeping
this field in sync, replace it by a function that determines the time
of the first dive.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/load-git.c')
-rw-r--r-- | core/load-git.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/core/load-git.c b/core/load-git.c index 8e3254abd..1447becb2 100644 --- a/core/load-git.c +++ b/core/load-git.c @@ -799,12 +799,6 @@ static void parse_dc_event(char *line, struct membuffer *str, void *_dc) } } -static void parse_trip_date(char *line, struct membuffer *str, void *_trip) -{ UNUSED(str); dive_trip_t *trip = _trip; update_date(&trip->when, line); } - -static void parse_trip_time(char *line, struct membuffer *str, void *_trip) -{ UNUSED(str); dive_trip_t *trip = _trip; update_time(&trip->when, line); } - static void parse_trip_location(char *line, struct membuffer *str, void *_trip) { UNUSED(line); dive_trip_t *trip = _trip; trip->location = get_utf8(str); } @@ -1007,7 +1001,7 @@ static void site_parser(char *line, struct membuffer *str, void *_ds) struct keyword_action trip_action[] = { #undef D #define D(x) { #x, parse_trip_ ## x } - D(date), D(location), D(notes), D(time), + D(location), D(notes), }; static void trip_parser(char *line, struct membuffer *str, void *_trip) @@ -1202,20 +1196,6 @@ static struct dive *create_new_dive(timestamp_t when) return dive; } -static dive_trip_t *create_new_trip(int yyyy, int mm, int dd) -{ - dive_trip_t *trip = alloc_trip(); - struct tm tm = { 0 }; - - /* We'll fill in the real data from the trip descriptor file */ - tm.tm_year = yyyy; - tm.tm_mon = mm-1; - tm.tm_mday = dd; - trip->when = utc_mktime(&tm); - - return trip; -} - static bool validate_date(int yyyy, int mm, int dd) { return yyyy > 1930 && yyyy < 3000 && @@ -1243,7 +1223,7 @@ static int dive_trip_directory(const char *root, const char *name) if (!validate_date(yyyy, mm, dd)) return GIT_WALK_SKIP; finish_active_trip(); - active_trip = create_new_trip(yyyy, mm, dd); + active_trip = alloc_trip(); return GIT_WALK_OK; } |