mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: turn divecomputer list into std::vector<>
Since struct divecomputer is now fully C++ (i.e. cleans up after itself), we can simply turn the list of divecomputers into an std::vector<>. This makes the code quite a bit simpler, because the first divecomputer was actually a subobject. Yes, this makes the common case of a single divecomputer a little bit less efficient, but it really shouldn't matter. If it does, we can still write a special std::vector<>- like container that keeps the first element inline. This change makes pointers-to-divecomputers not stable. So always access the divecomputer via its index. As far as I can tell, most of the code already does this. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
e237f29fb2
commit
284582d2e8
54 changed files with 738 additions and 893 deletions
|
@ -1014,9 +1014,9 @@ static int divinglog_dive_match(struct dive *dive, const char *name, char *buf,
|
|||
}
|
||||
return MATCH_STATE("divedate", divedate, &dive->when) ||
|
||||
MATCH_STATE("entrytime", divetime, &dive->when) ||
|
||||
MATCH("divetime", duration, &dive->dc.duration) ||
|
||||
MATCH_STATE("depth", depth, &dive->dc.maxdepth) ||
|
||||
MATCH_STATE("depthavg", depth, &dive->dc.meandepth) ||
|
||||
MATCH("divetime", duration, &dive->dcs[0].duration) ||
|
||||
MATCH_STATE("depth", depth, &dive->dcs[0].maxdepth) ||
|
||||
MATCH_STATE("depthavg", depth, &dive->dcs[0].meandepth) ||
|
||||
MATCH("comments", utf8_string, &dive->notes) ||
|
||||
MATCH("names.buddy", utf8_string, &dive->buddy) ||
|
||||
MATCH("name.country", utf8_string_std, &state->country) ||
|
||||
|
@ -1082,8 +1082,8 @@ uddf_datedata(min, 0)
|
|||
static int uddf_dive_match(struct dive *dive, const char *name, char *buf, struct parser_state *state)
|
||||
{
|
||||
return MATCH_STATE("datetime", uddf_datetime, &dive->when) ||
|
||||
MATCH("diveduration", duration, &dive->dc.duration) ||
|
||||
MATCH_STATE("greatestdepth", depth, &dive->dc.maxdepth) ||
|
||||
MATCH("diveduration", duration, &dive->dcs[0].duration) ||
|
||||
MATCH_STATE("greatestdepth", depth, &dive->dcs[0].maxdepth) ||
|
||||
MATCH_STATE("year.date", uddf_year, &dive->when) ||
|
||||
MATCH_STATE("month.date", uddf_mon, &dive->when) ||
|
||||
MATCH_STATE("day.date", uddf_mday, &dive->when) ||
|
||||
|
@ -1269,7 +1269,7 @@ static void try_to_fill_dive(struct dive *dive, const char *name, char *buf, str
|
|||
* Legacy format note: per-dive depths and duration get saved
|
||||
* in the first dive computer entry
|
||||
*/
|
||||
if (match_dc_data_fields(&dive->dc, name, buf, state))
|
||||
if (match_dc_data_fields(&dive->dcs[0], name, buf, state))
|
||||
return;
|
||||
|
||||
if (MATCH("filename.picture", utf8_string, &state->cur_picture.filename))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue