mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Add more infrastructure for a separate dive table
This will allow us to download the dives from the dive computer into a separate table just for that purpose and not into the main dive_table. I really dislike the code that's in place that dates back to the very earliest code written for Subsurface. Dumping the dives straight into the main dive_table seems really stupid to me. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
a92484e4ed
commit
6f25713408
3 changed files with 21 additions and 10 deletions
12
parse-xml.c
12
parse-xml.c
|
@ -48,10 +48,20 @@ int trimspace(char *buffer) {
|
|||
return size; // return string length
|
||||
}
|
||||
|
||||
/*
|
||||
* Clear a dive_table
|
||||
*/
|
||||
void clear_table(struct dive_table *table)
|
||||
{
|
||||
for (int i = 0; i < table->nr; i++)
|
||||
free(table->dives[i]);
|
||||
table->nr = 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a dive into the dive_table array
|
||||
*/
|
||||
static void record_dive_to_table(struct dive *dive, struct dive_table *table)
|
||||
void record_dive_to_table(struct dive *dive, struct dive_table *table)
|
||||
{
|
||||
assert(table != NULL);
|
||||
int nr = table->nr, allocated = table->allocated;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue