Skip to content

Commit

Permalink
remove unicode_util_compat library
Browse files Browse the repository at this point in the history
remove unicode_util_compat library and support only Erlang >= 20. This
change simplify the stack and prepare future change to support specific
features of Erlang 23 and sup.
  • Loading branch information
benoitc committed Dec 5, 2020
1 parent 7928324 commit 230a917
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 19 deletions.
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
language: erlang
otp_release:
- 19.3
- 20.0
- 20.1.7
- 20.3.8.22
Expand Down
4 changes: 4 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

== 7.0.0 - unreleased

- remove unicode_compat. only support Erlang >= 20

== 6.1.1 - 2020-12-06

- fix license information
Expand Down
2 changes: 1 addition & 1 deletion rebar.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{erl_opts, []}.

{deps, [{unicode_util_compat, "~>0.7.0"}]}.
{deps, []}.
9 changes: 1 addition & 8 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
{"1.2.0",
[{<<"unicode_util_compat">>,{pkg,<<"unicode_util_compat">>,<<"0.7.0">>},0}]}.
[
{pkg_hash,[
{<<"unicode_util_compat">>, <<"BC84380C9AB48177092F43AC89E4DFA2C6D62B40B8BD132B1059ECC7232F9A78">>}]},
{pkg_hash_ext,[
{<<"unicode_util_compat">>, <<"25EEE6D67DF61960CF6A794239566599B09E17E668D3700247BC498638152521">>}]}
].
[].
4 changes: 2 additions & 2 deletions src/idna.app.src
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{application, idna, [
{description, "A pure Erlang IDNA implementation"},
{vsn, "6.1.1"},
{vsn, "7.0.0"},
{modules, []},
{registered, []},
{applications, [kernel, stdlib, unicode_util_compat]},
{applications, [kernel, stdlib]},

{licenses, ["MIT"]},
{links, [{"Github", "https://github.com/benoitc/erlang-idna"}]}
Expand Down
10 changes: 5 additions & 5 deletions src/idna.erl
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ lowercase_list([], true) ->
lowercase_list([], false) ->
throw(unchanged);
lowercase_list(CPs0, Changed) ->
case unicode_util_compat:lowercase(CPs0) of
case unicode_util:lowercase(CPs0) of
[Char|CPs] when Char =:= hd(CPs0) -> [Char|lowercase_list(CPs, Changed)];
[Char|CPs] -> append(Char,lowercase_list(CPs, true));
[] -> lowercase_list([], Changed)
Expand All @@ -350,9 +350,9 @@ lowercase_bin(CP1, <<CP2/utf8, Bin/binary>>, Changed)
when CP1 < 128, CP2 < 256 ->
[CP1|lowercase_bin(CP2, Bin, Changed)];
lowercase_bin(CP1, Bin, Changed) ->
case unicode_util_compat:lowercase([CP1|Bin]) of
case unicode_util:lowercase([CP1|Bin]) of
[CP1|CPs] ->
case unicode_util_compat:cp(CPs) of
case unicode_util:cp(CPs) of
[Next|Rest] ->
[CP1|lowercase_bin(Next, Rest, Changed)];
[] when Changed ->
Expand All @@ -361,7 +361,7 @@ lowercase_bin(CP1, Bin, Changed) ->
throw(unchanged)
end;
[Char|CPs] ->
case unicode_util_compat:cp(CPs) of
case unicode_util:cp(CPs) of
[Next|Rest] ->
[Char|lowercase_bin(Next, Rest, true)];
[] ->
Expand All @@ -378,7 +378,7 @@ append(GC, Str) when is_list(GC) -> GC ++ Str.


characters_to_nfc_list(CD) ->
case unicode_util_compat:nfc(CD) of
case unicode_util:nfc(CD) of
[CPs|Str] when is_list(CPs) -> CPs ++ characters_to_nfc_list(Str);
[CP|Str] -> [CP|characters_to_nfc_list(Str)];
[] -> []
Expand Down
4 changes: 2 additions & 2 deletions src/idna_context.erl
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ valid_contextj(Label, Pos) ->
valid_contextj(16#200c, Label, Pos) ->
if
Pos > 0 ->
case unicode_util_compat:lookup(lists:nth(Pos, Label)) of
case unicode_util:lookup(lists:nth(Pos, Label)) of
#{ ccc := ?virama_combining_class } -> true;
_ ->
valid_contextj_1(Label, Pos)
Expand All @@ -35,7 +35,7 @@ valid_contextj(16#200c, Label, Pos) ->
end;

valid_contextj(16#200d, Label, Pos) when Pos > 0 ->
case unicode_util_compat:lookup(lists:nth(Pos, Label)) of
case unicode_util:lookup(lists:nth(Pos, Label)) of
#{ ccc := ?virama_combining_class } -> true;
_ -> false
end;
Expand Down

1 comment on commit 230a917

@zxq9
Copy link

@zxq9 zxq9 commented on 230a917 May 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this ever going to pushed as a tag v7.0.0 or similar?

Please # to comment.