aboutsummaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2020-06-30 01:27:01 +0200
committerNeels Hofmeyr <neels@hofmeyr.de>2020-06-30 04:24:59 +0200
commit9656e923bf0353bc44ce0f7dcadfe81b381458a3 (patch)
tree8fa8c031d16212000cba39fab592eb3f7b0654a7 /library
parent22c3f79c9891ecd861a4045a6376cd0dcbb8b781 (diff)
fixup for Osmocom_CTRL_Functions: rate counters in bulk
At the time of writing Ief0d9b096feeee7d37b5f2429dd3e80de0161806 I wasn't aware of the 'inout' keyword, which allows to pass the counter list by reference. Rather modify the counter lists in-place. Instead of requiring list := f_counter_name_vals_add(list, ...) rather implement by directly modifying list: f_counter_name_vals_add(list, ...) Change-Id: I85ac56b042fe4bb1db392c1f451c8e900582cc2a
Diffstat (limited to 'library')
-rw-r--r--library/Osmocom_CTRL_Functions.ttcn14
1 files changed, 6 insertions, 8 deletions
diff --git a/library/Osmocom_CTRL_Functions.ttcn b/library/Osmocom_CTRL_Functions.ttcn
index ee7025c9..60c66c0e 100644
--- a/library/Osmocom_CTRL_Functions.ttcn
+++ b/library/Osmocom_CTRL_Functions.ttcn
@@ -222,12 +222,12 @@ module Osmocom_CTRL_Functions {
}
/* In a list of one instance's counters, increment a specifically named counter. */
- function f_counter_name_vals_add(CounterNameVals vals, charstring countername, integer val := 1)
- return CounterNameVals{
+ function f_counter_name_vals_add(inout CounterNameVals vals, charstring countername, integer val := 1)
+ {
for (var integer i := 0; i < lengthof(vals); i := i + 1) {
if (vals[i].name == countername) {
vals[i].val := vals[i].val + val;
- return vals;
+ return;
}
}
/* name not found, append */
@@ -235,15 +235,13 @@ module Osmocom_CTRL_Functions {
name := countername,
val := val
}
- return vals;
}
/* In a list of several instances' counters, increment a specific instance's specifically named counter. */
- function f_counter_name_vals_list_add(CounterNameValsList vals, integer instance_nr,
+ function f_counter_name_vals_list_add(inout CounterNameValsList vals, integer instance_nr,
charstring countername, integer val := 1)
- return CounterNameValsList {
- vals[instance_nr] := f_counter_name_vals_add(vals[instance_nr], countername, val);
- return vals;
+ {
+ f_counter_name_vals_add(vals[instance_nr], countername, val);
}
/* For a specific instance, call f_counter_name_vals_get() and compare with expected counter values.