mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Improve the code handling air temperature
Better helper functions make for easier to understand code. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
b4c2fcc802
commit
c6da79e1b0
3 changed files with 24 additions and 26 deletions
17
save-xml.c
17
save-xml.c
|
@ -152,17 +152,14 @@ static void save_depths(FILE *f, struct divecomputer *dc)
|
|||
|
||||
static void save_dive_temperature(FILE *f, struct dive *dive)
|
||||
{
|
||||
temperature_t temp;
|
||||
temp.mkelvin = dive->airtemp.mkelvin;
|
||||
dive->airtemp.mkelvin = 0;
|
||||
fixup_airtemp(dive);
|
||||
if (dive->airtemp.mkelvin && temp.mkelvin != dive->airtemp.mkelvin) {
|
||||
fputs(" <divetemperature", f);
|
||||
show_temperature(f, temp, " air='", "'");
|
||||
fputs(" />\n", f);
|
||||
}
|
||||
dive->airtemp.mkelvin = temp.mkelvin;
|
||||
if (!dive->airtemp.mkelvin)
|
||||
return;
|
||||
if (dive->airtemp.mkelvin == dc_airtemp(&dive->dc))
|
||||
return;
|
||||
|
||||
fputs(" <divetemperature", f);
|
||||
show_temperature(f, dive->airtemp, " air='", "'");
|
||||
fputs("/>\n", f);
|
||||
}
|
||||
|
||||
static void save_temperatures(FILE *f, struct divecomputer *dc)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue