aboutsummaryrefslogtreecommitdiffstats
path: root/erts/preloaded
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-02-15 09:56:20 +0100
committerBjörn Gustavsson <[email protected]>2019-02-15 09:56:20 +0100
commitb4466ab778ae2278e29625d4b8220af3797fa3b6 (patch)
tree5dbb32a022aa76d71971e42c25e4173d74e1c16d /erts/preloaded
parent11d4a893e50b1738b01846a5e669addb3e5a4f75 (diff)
parent595c159823089d0186ec2617c174356d1ff2de65 (diff)
downloadotp-b4466ab778ae2278e29625d4b8220af3797fa3b6.tar.gz
otp-b4466ab778ae2278e29625d4b8220af3797fa3b6.tar.bz2
otp-b4466ab778ae2278e29625d4b8220af3797fa3b6.zip
Merge branch 'maint'
* maint: Add persistent_term:get(Key, DefaultValue) Make dialyzer faster for left-associative andalso/orelse expressions
Diffstat (limited to 'erts/preloaded')
-rw-r--r--erts/preloaded/ebin/persistent_term.beambin1692 -> 1836 bytes
-rw-r--r--erts/preloaded/src/persistent_term.erl9
2 files changed, 8 insertions, 1 deletions
diff --git a/erts/preloaded/ebin/persistent_term.beam b/erts/preloaded/ebin/persistent_term.beam
index e94ef983be..c882e4fad4 100644
--- a/erts/preloaded/ebin/persistent_term.beam
+++ b/erts/preloaded/ebin/persistent_term.beam
Binary files differ
diff --git a/erts/preloaded/src/persistent_term.erl b/erts/preloaded/src/persistent_term.erl
index 5d0c266127..ee7e49b6cb 100644
--- a/erts/preloaded/src/persistent_term.erl
+++ b/erts/preloaded/src/persistent_term.erl
@@ -19,7 +19,7 @@
%%
-module(persistent_term).
--export([erase/1,get/0,get/1,info/0,put/2]).
+-export([erase/1,get/0,get/1,get/2,info/0,put/2]).
-type key() :: term().
-type value() :: term().
@@ -41,6 +41,13 @@ get() ->
get(_Key) ->
erlang:nif_error(undef).
+-spec get(Key, Default) -> Value when
+ Key :: key(),
+ Default :: value(),
+ Value :: value().
+get(_Key, _Default) ->
+ erlang:nif_error(undef).
+
-spec info() -> Info when
Info :: #{'count':=Count,'memory':=Memory},
Count :: non_neg_integer(),