summaryrefslogtreecommitdiffstats
path: root/core/profile.h
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2019-07-05 22:56:27 +0200
committerGravatar Dirk Hohndel <dirk@hohndel.org>2019-07-18 05:50:22 -0700
commit29005b578de4680556f6a3fa01781a8af842ced8 (patch)
tree3b2985025b974f14bd3f2befb756defdfac34ffc /core/profile.h
parent1eafd500e329fedffba55a598e2755659fefc2fb (diff)
downloadsubsurface-29005b578de4680556f6a3fa01781a8af842ced8.tar.gz
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>
Diffstat (limited to 'core/profile.h')
-rw-r--r--core/profile.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/profile.h b/core/profile.h
index 010c21954..8e2912671 100644
--- a/core/profile.h
+++ b/core/profile.h
@@ -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
}