Move f_str_split() Osmocom_VTY_Functions.ttcn -> Misc_Helpers.ttcn
This is quite a generic string handling function which fits better
in a generic utility file like Misc_Helpers.ttcn.
Change-Id: I54eff3eea60ed0624919baebfe0ff7393414d6b8
diff --git a/library/Osmocom_VTY_Functions.ttcn b/library/Osmocom_VTY_Functions.ttcn
index 6b0883f..b982a8f 100644
--- a/library/Osmocom_VTY_Functions.ttcn
+++ b/library/Osmocom_VTY_Functions.ttcn
@@ -274,26 +274,7 @@
Misc_Helpers.f_shutdown(__BFILE__, __LINE__, fail, "talloc count mismatch");
}
-public function f_str_split(charstring str, charstring delim := "\n") return ro_charstring
-{
- var integer pos := 0;
- var ro_charstring parts := {};
- var integer delim_pos;
- var integer end := lengthof(str);
- while (pos < end) {
- delim_pos := f_strstr(str, delim, pos);
- if (delim_pos < 0) {
- delim_pos := end;
- }
- if (delim_pos > pos) {
- parts := parts & { substr(str, pos, delim_pos - pos) };
- }
- pos := delim_pos + 1;
- }
- return parts;
-}
-
-public function f_verify_talloc_bytes(TELNETasp_PT pt, ro_charstring object_strs, integer expect_bytes := 0,
+public function f_verify_talloc_bytes(TELNETasp_PT pt, Misc_Helpers.ro_charstring object_strs, integer expect_bytes := 0,
integer attempts := 5, float wait_time := 3.0)
{
var charstring show_cmd := "show talloc-context application brief";
@@ -302,7 +283,7 @@
attempts := attempts - 1;
var charstring ret := f_vty_transceive_ret(pt, show_cmd);
- var ro_charstring lines := f_str_split(ret);
+ var Misc_Helpers.ro_charstring lines := f_str_split(ret);
var boolean ok := true;
for (var integer i := 0; i < lengthof(object_strs); i := i + 1) {
@@ -315,7 +296,7 @@
if (f_strstr(line, object_str) < 0) {
continue;
}
- var ro_charstring tokens := f_str_split(line, " ");
+ var Misc_Helpers.ro_charstring tokens := f_str_split(line, " ");
if (lengthof(tokens) < 4) {
continue;
}