Cleanup: turn GET_PRESSURE macro into inline function

There is absolutely no reason to use a macro here.
The only argument that can be made is consistency with
the other pressure-macros, but those too are questionable.

Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
Berthold Stoeger 2019-07-05 22:56:27 +02:00 committed by Dirk Hohndel
parent 1eafd500e3
commit 29005b578d
3 changed files with 22 additions and 17 deletions

View file

@ -99,7 +99,12 @@ int get_maxdepth(struct plot_info *pi);
#define INTERPOLATED_PR 1
#define SENSOR_PRESSURE(_entry,_idx) (_entry)->pressure[_idx][SENSOR_PR]
#define INTERPOLATED_PRESSURE(_entry,_idx) (_entry)->pressure[_idx][INTERPOLATED_PR]
#define GET_PRESSURE(_entry,_idx) (SENSOR_PRESSURE(_entry,_idx) ? SENSOR_PRESSURE(_entry,_idx) : INTERPOLATED_PRESSURE(_entry,_idx))
static inline int get_plot_pressure(const struct plot_data *entry, int idx)
{
int res = SENSOR_PRESSURE(entry, idx);
return res ? res : INTERPOLATED_PRESSURE(entry, idx);
}
#ifdef __cplusplus
}