Skip to content

Commit

Permalink
Removed unicode_str
Browse files Browse the repository at this point in the history
* introduced in f8f72b7
* introduced for working around compile warning starting from R20
* CI/CD uses R23 and onwards.
  • Loading branch information
Ariel Otilibili committed Mar 7, 2024
1 parent 45a1d45 commit f878e9f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 29 deletions.
8 changes: 1 addition & 7 deletions src/ec_date.erl
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ parse(Date, Now) ->
do_parse(Date, Now, []).

do_parse(Date, Now, Opts) ->
case filter_hints(parse(tokenise(uppercase(Date), []), Now, Opts)) of
case filter_hints(parse(tokenise(string:uppercase(Date), []), Now, Opts)) of
{error, bad_date} ->
erlang:throw({?MODULE, {bad_date, Date}});
{D1, T1} = {{Y, M, D}, {H, M1, S}}
Expand Down Expand Up @@ -709,12 +709,6 @@ pad6(X) when is_integer(X) ->
ltoi(X) ->
list_to_integer(X).

-ifdef(unicode_str).
uppercase(Str) -> string:uppercase(Str).
-else.
uppercase(Str) -> string:to_upper(Str).
-endif.

%%%===================================================================
%%% Tests
%%%===================================================================
Expand Down
15 changes: 2 additions & 13 deletions src/ec_git_vsn.erl
Original file line number Diff line number Diff line change
Expand Up @@ -94,22 +94,11 @@ parse_tags(Pattern) ->
"fatal: " ++ _ ->
{undefined, ""};
_ ->
Vsn = slice(Tag, len(Pattern)),
Vsn1 = trim(trim(Vsn, left, "v"), right, "\n"),
Vsn = string:slice(Tag, string:length(Pattern)),
Vsn1 = string:trim(string:trim(Vsn, leading, "v"), trailing, "\n"),
{Tag, Vsn1}
end.

-ifdef(unicode_str).
len(Str) -> string:length(Str).
trim(Str, right, Chars) -> string:trim(Str, trailing, Chars);
trim(Str, left, Chars) -> string:trim(Str, leading, Chars).
slice(Str, Len) -> string:slice(Str, Len).
-else.
len(Str) -> string:len(Str).
trim(Str, Dir, [Chars|_]) -> string:strip(Str, Dir, Chars).
slice(Str, Len) -> string:substr(Str, Len + 1).
-endif.

-ifdef(TEST).
-include_lib("eunit/include/eunit.hrl").

Expand Down
10 changes: 1 addition & 9 deletions src/ec_talk.erl
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ ask_convert(Prompt, TransFun, Type, Default) ->
Default ->
[" (", io_lib:format("~p", [Default]) , ")"]
end, "> "])),
Data = trim(trim(io:get_line(NewPrompt)), both, [$\n]),
Data = string:trim(string:trim(io:get_line(NewPrompt)), both, [$\n]),
Ret = TransFun(Data),
case Ret of
no_data ->
Expand Down Expand Up @@ -197,14 +197,6 @@ get_string(String) ->
no_clue
end.

-ifdef(unicode_str).
trim(Str) -> string:trim(Str).
trim(Str, both, Chars) -> string:trim(Str, both, Chars).
-else.
trim(Str) -> string:strip(Str).
trim(Str, Dir, [Chars|_]) -> string:strip(Str, Dir, Chars).
-endif.

%%%====================================================================
%%% tests
%%%====================================================================
Expand Down

0 comments on commit f878e9f

Please sign in to comment.