Remove is_air() and convert its users to gasmix

Also make gasname() and get_gas_string() global functions (which allows us
to delete code elsewhere).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2014-06-01 20:56:29 -07:00
parent ee36bf8bf3
commit 28093ae957
5 changed files with 26 additions and 36 deletions

12
dive.h
View file

@ -108,14 +108,11 @@ extern void sanitize_gasmix(struct gasmix *mix);
extern int gasmix_distance(const struct gasmix *a, const struct gasmix *b);
extern struct gasmix *get_gasmix_from_event(struct event *ev);
static inline bool is_air(int o2, int he)
{
return (he == 0) && (o2 == 0 || ((o2 >= O2_IN_AIR - 1) && (o2 <= O2_IN_AIR + 1)));
}
static inline bool gasmix_is_air(const struct gasmix *gasmix)
{
return is_air(gasmix->o2.permille, gasmix->he.permille);
int o2 = gasmix->o2.permille;
int he = gasmix->he.permille;
return (he == 0) && (o2 == 0 || ((o2 >= O2_IN_AIR - 1) && (o2 <= O2_IN_AIR + 1)));
}
/* in the planner we use a null gasmix to indicate that we keep using the gas as before
@ -140,6 +137,9 @@ static inline depth_t gas_mod(struct gasmix *mix, pressure_t po2_limit) {
return depth;
}
void get_gas_string(const struct gasmix *gasmix, char *text, int len);
const char *gasname(const struct gasmix *gasmix);
struct sample {
duration_t time;
depth_t depth;