diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2018-07-18 08:01:25 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2018-07-18 09:04:47 -0700 |
commit | 8ff7314b219d2eab85f7777e470091a76cf25107 (patch) | |
tree | 0f77da8b2d638f7b64a3bdc6caa8f2b274395472 | |
parent | 3a933637dab9aa4fee55198623a6f9235727cfde (diff) | |
download | subsurface-8ff7314b219d2eab85f7777e470091a76cf25107.tar.gz |
Cleanup: rename trip->index to trip->saved
The index-field was misused by the IO routines to mark which dives
had been saved. Somewhat questionable, but let's at least name the
field accordingly.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r-- | core/dive.h | 3 | ||||
-rw-r--r-- | core/save-git.c | 6 | ||||
-rw-r--r-- | core/save-html.c | 6 | ||||
-rw-r--r-- | core/save-xml.c | 6 |
4 files changed, 11 insertions, 10 deletions
diff --git a/core/dive.h b/core/dive.h index 8458a3ae3..1b58eef4c 100644 --- a/core/dive.h +++ b/core/dive.h @@ -294,7 +294,8 @@ typedef struct dive_trip char *notes; struct dive *dives; int nrdives; - int index; + /* Used by the io-routines to mark trips that have already been written. */ + bool saved; unsigned expanded : 1, selected : 1, autogen : 1, fixup : 1; struct dive_trip *next; } dive_trip_t; diff --git a/core/save-git.c b/core/save-git.c index 8e5891969..fcfbd93d1 100644 --- a/core/save-git.c +++ b/core/save-git.c @@ -954,7 +954,7 @@ static int create_git_tree(git_repository *repo, struct dir *root, bool select_o save_divesites(repo, root); for (trip = dive_trip_list; trip != NULL; trip = trip->next) - trip->index = 0; + trip->saved = 0; /* save the dives */ git_storage_update_progress(translate("gettextFromC", "Start saving dives")); @@ -979,9 +979,9 @@ static int create_git_tree(git_repository *repo, struct dir *root, bool select_o if (trip) { /* Did we already save this trip? */ - if (trip->index) + if (trip->saved) continue; - trip->index = 1; + trip->saved = 1; /* Pass that new subdirectory in for save-trip */ save_one_trip(repo, tree, trip, &tm, cached_ok); diff --git a/core/save-html.c b/core/save-html.c index 1825c51a1..2081b2eab 100644 --- a/core/save-html.c +++ b/core/save-html.c @@ -435,17 +435,17 @@ void write_trips(struct membuffer *b, const char *photos_dir, bool selected_only char *sep = &sep_; for (trip = dive_trip_list; trip != NULL; trip = trip->next) - trip->index = 0; + trip->saved = 0; for_each_dive (i, dive) { trip = dive->divetrip; /*Continue if the dive have no trips or we have seen this trip before*/ - if (!trip || trip->index) + if (!trip || trip->saved) continue; /* We haven't seen this trip before - save it and all dives */ - trip->index = 1; + trip->saved = 1; write_trip(b, trip, &dive_no, selected_only, photos_dir, list_only, sep); } diff --git a/core/save-xml.c b/core/save-xml.c index 10638e289..e3af000a4 100644 --- a/core/save-xml.c +++ b/core/save-xml.c @@ -625,7 +625,7 @@ void save_dives_buffer(struct membuffer *b, const bool select_only) } put_format(b, "</divesites>\n<dives>\n"); for (trip = dive_trip_list; trip != NULL; trip = trip->next) - trip->index = 0; + trip->saved = 0; /* save the dives */ for_each_dive(i, dive) { @@ -645,11 +645,11 @@ void save_dives_buffer(struct membuffer *b, const bool select_only) } /* Have we already seen this trip (and thus saved this dive?) */ - if (trip->index) + if (trip->saved) continue; /* We haven't seen this trip before - save it and all dives */ - trip->index = 1; + trip->saved = 1; save_trip(b, trip); } } |