aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2022-10-22 21:50:20 +0200
committerGravatar Tim Segers <tsegers@pm.me>2022-10-22 21:50:20 +0200
commit5990826a3b7fd661b234c53d0739f68eb138b3cb (patch)
treed6dcd45b4bb347223a807daddcdb10b71a74b87f /src
parent2e54be8428e075663c632645382c6588bdec2e84 (diff)
downloadopendeco-5990826a3b7fd661b234c53d0739f68eb138b3cb.tar.gz
Remove const qualifier from non-pointer parameters
Diffstat (limited to 'src')
-rw-r--r--src/deco.c18
-rw-r--r--src/deco.h19
-rw-r--r--src/opendeco.c4
-rw-r--r--src/output.c6
-rw-r--r--src/output.h4
-rw-r--r--src/schedule.c17
-rw-r--r--src/schedule.h14
7 files changed, 40 insertions, 42 deletions
diff --git a/src/deco.c b/src/deco.c
index 51cdf0e..e1ea401 100644
--- a/src/deco.c
+++ b/src/deco.c
@@ -67,27 +67,27 @@ const zhl_he_t ZHL16He[] = {
{.t = 240.03, .a = 0.5119, .b = 0.9267},
};
-double bar_to_msw(const double bar)
+double bar_to_msw(double bar)
{
return bar * 10;
}
-double msw_to_bar(const double msw)
+double msw_to_bar(double msw)
{
return msw / 10;
}
-double abs_depth(const double gd)
+double abs_depth(double gd)
{
return gd + SURFACE_PRESSURE;
}
-double gauge_depth(const double ad)
+double gauge_depth(double ad)
{
return ad - SURFACE_PRESSURE;
}
-gas_t gas_new(const unsigned char o2, const unsigned char he, double mod)
+gas_t gas_new(unsigned char o2, unsigned char he, double mod)
{
assert(o2 + he <= 100);
@@ -126,7 +126,7 @@ double gas_mod(const gas_t *gas)
return gas->mod;
}
-double add_segment_ascdec(decostate_t *ds, const double dstart, const double dend, const double time, const gas_t *gas)
+double add_segment_ascdec(decostate_t *ds, double dstart, double dend, double time, const gas_t *gas)
{
assert(time > 0);
@@ -161,7 +161,7 @@ double add_segment_ascdec(decostate_t *ds, const double dstart, const double den
return time;
}
-double add_segment_const(decostate_t *ds, const double depth, const double time, const gas_t *gas)
+double add_segment_const(decostate_t *ds, double depth, double time, const gas_t *gas)
{
assert(time > 0);
@@ -192,7 +192,7 @@ double add_segment_const(decostate_t *ds, const double depth, const double time,
return time;
}
-double get_gf(const decostate_t *ds, const double depth)
+double get_gf(const decostate_t *ds, double depth)
{
const unsigned char lo = ds->gflo;
const unsigned char hi = ds->gfhi;
@@ -277,7 +277,7 @@ void init_tissues(decostate_t *ds)
ds->phe[i] = phe;
}
-void init_decostate(decostate_t *ds, const unsigned char gflo, const unsigned char gfhi, const double ceil_multiple)
+void init_decostate(decostate_t *ds, unsigned char gflo, unsigned char gfhi, double ceil_multiple)
{
assert(gflo <= gfhi);
diff --git a/src/deco.h b/src/deco.h
index cef35d4..35905ca 100644
--- a/src/deco.h
+++ b/src/deco.h
@@ -59,26 +59,25 @@ extern double END_MAX;
extern int LAST_STOP_AT_SIX;
/* functions */
-double bar_to_msw(const double bar);
-double msw_to_bar(const double msw);
-double abs_depth(const double gd);
-double gauge_depth(const double ad);
+double bar_to_msw(double bar);
+double msw_to_bar(double msw);
+double abs_depth(double gd);
+double gauge_depth(double ad);
-gas_t gas_new(const unsigned char o2, const unsigned char he, double mod);
+gas_t gas_new(unsigned char o2, unsigned char he, double mod);
int gas_equal(const gas_t *g1, const gas_t *g2);
unsigned char gas_o2(const gas_t *gas);
unsigned char gas_he(const gas_t *gas);
unsigned char gas_n2(const gas_t *gas);
double gas_mod(const gas_t *gas);
-double add_segment_ascdec(decostate_t *ds, const double dstart, const double dend, const double time,
- const gas_t *gas);
-double add_segment_const(decostate_t *ds, const double depth, const double time, const gas_t *gas);
-double get_gf(const decostate_t *ds, const double depth);
+double add_segment_ascdec(decostate_t *ds, double dstart, double dend, double time, const gas_t *gas);
+double add_segment_const(decostate_t *ds, double depth, double time, const gas_t *gas);
+double get_gf(const decostate_t *ds, double depth);
double ceiling(const decostate_t *ds, double gf);
double gf99(const decostate_t *ds, double depth);
-void init_decostate(decostate_t *ds, const unsigned char gflo, const unsigned char gfhi, const double ceil_multiple);
+void init_decostate(decostate_t *ds, unsigned char gflo, unsigned char gfhi, double ceil_multiple);
double ppO2(double depth, const gas_t *gas);
double end(double depth, const gas_t *gas);
diff --git a/src/opendeco.c b/src/opendeco.c
index 8c3f52c..6b49b97 100644
--- a/src/opendeco.c
+++ b/src/opendeco.c
@@ -139,7 +139,7 @@ static struct gas_usage {
double usage;
} gas_usage[10];
-int register_gas_use(const double depth, const double time, const gas_t *gas, const double rmv)
+int register_gas_use(double depth, double time, const gas_t *gas, double rmv)
{
double usage = depth * time * rmv;
@@ -174,7 +174,7 @@ void print_gas_use(void)
}
}
-void print_segment_callback_fn(const decostate_t *ds, const waypoint_t wp, segtype_t type, void *arg)
+void print_segment_callback_fn(const decostate_t *ds, waypoint_t wp, segtype_t type, void *arg)
{
static double last_depth;
static double runtime;
diff --git a/src/output.c b/src/output.c
index 56a78c2..52b45dd 100644
--- a/src/output.c
+++ b/src/output.c
@@ -6,7 +6,7 @@
#include "output.h"
-void format_mm_ss(char *buf, const size_t buflen, const double time)
+void format_mm_ss(char *buf, size_t buflen, double time)
{
double mm;
double ss = round(modf(time, &mm) * 60);
@@ -18,7 +18,7 @@ void format_mm_ss(char *buf, const size_t buflen, const double time)
snprintf(buf, buflen, "%3i:%02i", (int) mm, (int) ss);
}
-void format_gas(char *buf, const size_t buflen, const gas_t *gas)
+void format_gas(char *buf, size_t buflen, const gas_t *gas)
{
if (gas_o2(gas) == 21 && gas_he(gas) == 0)
snprintf(buf, buflen, "Air");
@@ -59,7 +59,7 @@ void print_planhead(void)
"EAD");
}
-void print_planline(const wchar_t sign, const double depth, const double time, const double runtime, const gas_t *gas)
+void print_planline(wchar_t sign, double depth, double time, double runtime, const gas_t *gas)
{
static char gasbuf[11];
static char runbuf[8];
diff --git a/src/output.h b/src/output.h
index 8e602a6..d6d00f3 100644
--- a/src/output.h
+++ b/src/output.h
@@ -15,10 +15,10 @@
/* functions */
void print_planhead(void);
-void print_planline(const wchar_t sign, const double depth, const double time, const double runtime, const gas_t *gas);
+void print_planline(wchar_t sign, double depth, double time, double runtime, const gas_t *gas);
void print_planfoot(const decostate_t *ds);
void scan_gas(gas_t *gas, char *str);
-void format_gas(char *buf, const size_t buflen, const gas_t *gas);
+void format_gas(char *buf, size_t buflen, const gas_t *gas);
#endif /* end of include guard: OUTPUT_H */
diff --git a/src/schedule.c b/src/schedule.c
index 1a002e0..f9d3dd4 100644
--- a/src/schedule.c
+++ b/src/schedule.c
@@ -10,7 +10,7 @@
int SWITCH_INTERMEDIATE = SWITCH_INTERMEDIATE_DEFAULT;
-const gas_t *best_gas(const double depth, const gas_t *gasses, const int nof_gasses)
+const gas_t *best_gas(double depth, const gas_t *gasses, int nof_gasses)
{
const gas_t *best = NULL;
double mod_best = -1;
@@ -27,7 +27,7 @@ const gas_t *best_gas(const double depth, const gas_t *gasses, const int nof_gas
return best;
}
-int direct_ascent(const decostate_t *ds, const double depth, const double time, const gas_t *gas)
+int direct_ascent(const decostate_t *ds, double depth, double time, const gas_t *gas)
{
decostate_t ds_ = *ds;
assert(ds_.firststop == -1);
@@ -37,7 +37,7 @@ int direct_ascent(const decostate_t *ds, const double depth, const double time,
return gauge_depth(ceiling(&ds_, ds_.gfhi)) <= 0;
}
-void simulate_dive(decostate_t *ds, waypoint_t *waypoints, const int nof_waypoints, waypoint_callback_t *wp_cb)
+void simulate_dive(decostate_t *ds, const waypoint_t *waypoints, int nof_waypoints, const waypoint_callback_t *wp_cb)
{
double depth = abs_depth(0);
@@ -58,7 +58,7 @@ void simulate_dive(decostate_t *ds, waypoint_t *waypoints, const int nof_waypoin
}
}
-double calc_ndl(decostate_t *ds, const double depth, const double ascrate, const gas_t *gas)
+double calc_ndl(decostate_t *ds, double depth, double ascrate, const gas_t *gas)
{
double ndl = 0;
@@ -92,8 +92,7 @@ double calc_ndl(decostate_t *ds, const double depth, const double ascrate, const
return ndl;
}
-double deco_stop(decostate_t *ds, const double depth, const double next_stop, const double current_gf,
- const gas_t *gas)
+double deco_stop(decostate_t *ds, double depth, double next_stop, double current_gf, const gas_t *gas)
{
double stoplen = 0;
@@ -119,13 +118,13 @@ double deco_stop(decostate_t *ds, const double depth, const double next_stop, co
return stoplen;
}
-static int surfaced(const double depth)
+static int surfaced(double depth)
{
return fabs(depth - SURFACE_PRESSURE) < 1E-2;
}
-decoinfo_t calc_deco(decostate_t *ds, const double start_depth, const gas_t *start_gas, const gas_t *deco_gasses,
- const int nof_gasses, waypoint_callback_t *wp_cb)
+decoinfo_t calc_deco(decostate_t *ds, double start_depth, const gas_t *start_gas, const gas_t *deco_gasses,
+ int nof_gasses, const waypoint_callback_t *wp_cb)
{
decoinfo_t ret = {.tts = 0, .ndl = 0};
diff --git a/src/schedule.h b/src/schedule.h
index 299217e..d450232 100644
--- a/src/schedule.h
+++ b/src/schedule.h
@@ -30,7 +30,7 @@ typedef enum segtype_t {
} segtype_t;
typedef struct waypoint_callback_t {
- void (*fn)(const decostate_t *ds, const waypoint_t, const segtype_t, void *arg);
+ void (*fn)(const decostate_t *, waypoint_t, segtype_t, void *);
void *arg;
} waypoint_callback_t;
@@ -38,14 +38,14 @@ typedef struct waypoint_callback_t {
extern int SWITCH_INTERMEDIATE;
/* functions */
-const gas_t *best_gas(const double depth, const gas_t *gasses, const int nof_gasses);
+const gas_t *best_gas(double depth, const gas_t *gasses, int nof_gasses);
-int direct_ascent(const decostate_t *ds, const double depth, const double time, const gas_t *gas);
-double calc_ndl(decostate_t *ds, const double depth, const double ascrate, const gas_t *gas);
+int direct_ascent(const decostate_t *ds, double depth, double time, const gas_t *gas);
+double calc_ndl(decostate_t *ds, double depth, double ascrate, const gas_t *gas);
-void simulate_dive(decostate_t *ds, waypoint_t *waypoints, const int nof_waypoints, waypoint_callback_t *wp_cb);
+void simulate_dive(decostate_t *ds, const waypoint_t *waypoints, int nof_waypoints, const waypoint_callback_t *wp_cb);
-decoinfo_t calc_deco(decostate_t *ds, const double start_depth, const gas_t *start_gas, const gas_t *deco_gasses,
- const int nof_gasses, waypoint_callback_t *wp_cb);
+decoinfo_t calc_deco(decostate_t *ds, double start_depth, const gas_t *start_gas, const gas_t *deco_gasses,
+ int nof_gasses, const waypoint_callback_t *wp_cb);
#endif /* end of include guard: SCHEDULE_H */