Automatically renumber new dives when they are "obvious".

When importing (or reading xml from files) new dives, we now renumber
them based on preexisting dive data, *if* such re-numbering is obvious.

NOTE! In order to be "obvious", there can be no overlap between old and
new dives: all the new dives have to come at the end.  That's what
happens with a normal libdivecomputer import, since we cut the import
short when we find a preexisting dive.

But if any of the new dives overlap the old dives in any way, or already
have been numbered separately, the automatic renumbering is not done,
and you need to do a manual renumber.

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Linus Torvalds 2011-10-05 08:31:31 -07:00
parent f4820455e2
commit d6c2236b8a
3 changed files with 65 additions and 3 deletions

2
dive.h
View file

@ -201,7 +201,7 @@ extern struct units input_units, output_units;
extern int verbose;
struct dive_table {
int nr, allocated;
int nr, allocated, preexisting;
struct dive **dives;
};