aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-02-12 14:10:22 +0100
committerBjörn Gustavsson <[email protected]>2013-02-13 11:58:45 +0100
commit7d22cccf18dd44507ee072315036d5023d09d47a (patch)
treebe95ee7de6297ed28f29bc06eb83561087c7788f
parente306b333a7a01b145c328521111c8e4cc388be19 (diff)
downloadotp-7d22cccf18dd44507ee072315036d5023d09d47a.tar.gz
otp-7d22cccf18dd44507ee072315036d5023d09d47a.tar.bz2
otp-7d22cccf18dd44507ee072315036d5023d09d47a.zip
Optimize character sets using gb_sets
-rw-r--r--lib/stdlib/src/filelib.erl7
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/stdlib/src/filelib.erl b/lib/stdlib/src/filelib.erl
index de49e5df6b..93e700284c 100644
--- a/lib/stdlib/src/filelib.erl
+++ b/lib/stdlib/src/filelib.erl
@@ -305,10 +305,7 @@ match_part([double_star], _) ->
match_part([star|Rest], File) ->
do_star(Rest, File);
match_part([{one_of, Ordset}|Rest], [C|File]) ->
- case ordsets:is_element(C, Ordset) of
- true -> match_part(Rest, File);
- false -> false
- end;
+ gb_sets:is_element(C, Ordset) andalso match_part(Rest, File);
match_part([{alt, Alts}], File) ->
do_alt(Alts, File);
match_part([C|Rest1], [C|Rest2]) when is_integer(C) ->
@@ -460,7 +457,7 @@ compile_charset(List, Ordset) ->
compile_charset1([Lower, $-, Upper|Rest], Ordset) when Lower =< Upper ->
compile_charset1(Rest, compile_range(Lower, Upper, Ordset));
compile_charset1([$]|Rest], Ordset) ->
- {ok, {one_of, Ordset}, Rest};
+ {ok, {one_of, gb_sets:from_ordset(Ordset)}, Rest};
compile_charset1([X|Rest], Ordset) ->
compile_charset1(Rest, ordsets:add_element(X, Ordset));
compile_charset1([], _Ordset) ->