mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
core: replace add_sample() by append_sample()
add_sample() was used in only one place, and the return value was always ignored. It took a time parameter, suggesting that a sample could be added anywhere, but in reality the sample was added at the end of the list. It used prepare_sample() that copies data from the previous sample, just to overwrite it with the newly added sample. All in all very weird. Simplify the function: just append the passed in sample and name it accordingly. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
af6201f89c
commit
c27314d603
3 changed files with 15 additions and 18 deletions
|
@ -263,15 +263,9 @@ struct sample *prepare_sample(struct divecomputer *dc)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
struct sample *add_sample(const struct sample *sample, int time, struct divecomputer *dc)
|
||||
void append_sample(const struct sample &sample, struct divecomputer *dc)
|
||||
{
|
||||
struct sample *p = prepare_sample(dc);
|
||||
|
||||
if (p) {
|
||||
*p = *sample;
|
||||
p->time.seconds = time;
|
||||
}
|
||||
return p;
|
||||
dc->samples.push_back(sample);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue