Simplify `platform_define` rebar configs
@@ -1,5 +1,4 @@
-{erl_opts, [{platform_define, "^(1[89])|^([2-9][0-9])", 'FAST_MAPS'}, % Erlang >=18
- {platform_define, "^(R|1|20)", 'FUN_STACKTRACE'}]}. % Erlang < 21
+{erl_opts, [{platform_define, "^17", 'SLOW_MAPS'}]}. % Erlang 17
{eunit_opts, [verbose]}.
@@ -108,7 +108,7 @@
-type cb_state() :: term().
%% See https://github.com/erlang/rebar3/pull/1773
--ifdef(FUN_STACKTRACE).
+-ifndef(OTP_RELEASE). % pre-OTP21
-define(WITH_STACKTRACE(T, R, S), T:R -> S = erlang:get_stacktrace(), ).
-else.
-define(WITH_STACKTRACE(T, R, S), T:R:S ->).
@@ -151,7 +151,7 @@ join_prepend(Sep, [H | T]) -> [Sep, H | join_prepend(Sep, T)].
%% K-V storage
%% In Erlang 17 map access time is O(n), so, it's faster to use dicts.
%% In Erlang >=18 maps are the most eficient choice
--ifdef(FAST_MAPS).
+-ifndef(SLOW_MAPS).
-type kv(K, V) :: #{K => V}.
@@ -134,7 +134,7 @@ bin_xor(B1, B2) ->
crypto:exor(B1, B2).
unique() ->
erlang:unique_integer([positive]).