summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--TODO-RELEASE1
-rw-r--r--include/osmocom/core/tdef.h2
-rw-r--r--src/tdef.c3
3 files changed, 4 insertions, 2 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 8ccfa491..665ecf79 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -7,3 +7,4 @@
# If any interfaces have been added since the last public release: c:r:a + 1.
# If any interfaces have been removed or changed since the last public release: c:r:0.
#library what description / commit summary line
+core osmo_tdef_get() change val_if_not_present arg from unsigned long to long to allow passing -1
diff --git a/include/osmocom/core/tdef.h b/include/osmocom/core/tdef.h
index c8d9053d..566f5dd3 100644
--- a/include/osmocom/core/tdef.h
+++ b/include/osmocom/core/tdef.h
@@ -95,7 +95,7 @@ struct osmo_tdef {
void osmo_tdefs_reset(struct osmo_tdef *tdefs);
unsigned long osmo_tdef_get(const struct osmo_tdef *tdefs, int T, enum osmo_tdef_unit as_unit,
- unsigned long val_if_not_present);
+ long val_if_not_present);
struct osmo_tdef *osmo_tdef_get_entry(struct osmo_tdef *tdefs, int T);
/*! Using osmo_tdef for osmo_fsm_inst: array entry for a mapping of state numbers to timeout definitions.
diff --git a/src/tdef.c b/src/tdef.c
index 3cfb17c0..40a99002 100644
--- a/src/tdef.c
+++ b/src/tdef.c
@@ -183,10 +183,11 @@ void osmo_tdefs_reset(struct osmo_tdef *tdefs)
* \param[in] val_if_not_present Fallback value to return if no timeout is defined.
* \return Timeout value in the unit given by as_unit, rounded up if necessary, or val_if_not_present.
*/
-unsigned long osmo_tdef_get(const struct osmo_tdef *tdefs, int T, enum osmo_tdef_unit as_unit, unsigned long val_if_not_present)
+unsigned long osmo_tdef_get(const struct osmo_tdef *tdefs, int T, enum osmo_tdef_unit as_unit, long val_if_not_present)
{
const struct osmo_tdef *t = osmo_tdef_get_entry((struct osmo_tdef*)tdefs, T);
if (!t) {
+ OSMO_ASSERT(val_if_not_present >= 0);
return val_if_not_present;
}
return osmo_tdef_round(t->val, t->unit, as_unit);