diff options
author | Dan Gudmundsson <[email protected]> | 2017-08-23 09:43:35 +0200 |
---|---|---|
committer | Siri Hansen <[email protected]> | 2017-09-15 17:07:52 +0200 |
commit | 5a9f3a48b2a6b58df16eb4a78d50ecd8f378bbd8 (patch) | |
tree | 4f2ad71e0a2f5202cfc3cbc9756a31c5f653eb0f /lib/hipe | |
parent | 3655794f0f1b0abe3629d7d7aa1f34cb6220b04f (diff) | |
download | otp-5a9f3a48b2a6b58df16eb4a78d50ecd8f378bbd8.tar.gz otp-5a9f3a48b2a6b58df16eb4a78d50ecd8f378bbd8.tar.bz2 otp-5a9f3a48b2a6b58df16eb4a78d50ecd8f378bbd8.zip |
hipe (test): Do not use deprecated functions in string(3)
Diffstat (limited to 'lib/hipe')
-rw-r--r-- | lib/hipe/test/hipe_testsuite_driver.erl | 10 | ||||
-rw-r--r-- | lib/hipe/test/opt_verify_SUITE.erl | 6 |
2 files changed, 6 insertions, 10 deletions
diff --git a/lib/hipe/test/hipe_testsuite_driver.erl b/lib/hipe/test/hipe_testsuite_driver.erl index 88576775ca..ee9c57a908 100644 --- a/lib/hipe/test/hipe_testsuite_driver.erl +++ b/lib/hipe/test/hipe_testsuite_driver.erl @@ -29,13 +29,9 @@ get_suites(SuitesWithSuiteSuffix) -> [S || {yes, S} <- Prefixes]. suffix(String, Suffix) -> - case string:rstr(String, Suffix) of - 0 -> no; - Index -> - case string:substr(String, Index) =:= Suffix of - true -> {yes, string:sub_string(String, 1, Index-1)}; - false -> no - end + case string:split(String, Suffix, trailing) of + [Prefix,[]] -> {yes, Prefix}; + _ -> no end. -spec file_type(file:filename()) -> {ok, file_type()} | {error, ext_posix()}. diff --git a/lib/hipe/test/opt_verify_SUITE.erl b/lib/hipe/test/opt_verify_SUITE.erl index 86083fa02b..79bc2f1f73 100644 --- a/lib/hipe/test/opt_verify_SUITE.erl +++ b/lib/hipe/test/opt_verify_SUITE.erl @@ -59,7 +59,7 @@ call_elim_test_file(Config, FileName, Option) -> substring_count(Icode, Substring) -> substring_count(Icode, Substring, 0). substring_count(Icode, Substring, N) -> - case string:str(Icode, Substring) of - 0 -> N; - I -> substring_count(lists:nthtail(I, Icode), Substring, N+1) + case string:find(Icode, Substring) of + nomatch -> N; + Prefix -> substring_count(string:prefix(Prefix, Substring), Substring, N+1) end. |