diff options
author | Björn Gustavsson <[email protected]> | 2014-01-31 10:47:42 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2014-01-31 16:04:30 +0100 |
commit | 17411317c3bfe8b0c557db5cb388e1874706b13a (patch) | |
tree | 08622a55d32e05a7e1dd96becbb4bce2ac0f88c1 /lib/asn1 | |
parent | 014c095621a5d5f3b04184cd78b678dca69cac86 (diff) | |
download | otp-17411317c3bfe8b0c557db5cb388e1874706b13a.tar.gz otp-17411317c3bfe8b0c557db5cb388e1874706b13a.tar.bz2 otp-17411317c3bfe8b0c557db5cb388e1874706b13a.zip |
asn1ct_table: Silence a dialyzer warning for unmatched return
Change the code so that delete/1 always returns 'true'.
While at it, also remove the TODO comment and explain in a comment
why we want to keep the delete/1 function.
Diffstat (limited to 'lib/asn1')
-rw-r--r-- | lib/asn1/src/asn1ct_table.erl | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/asn1/src/asn1ct_table.erl b/lib/asn1/src/asn1ct_table.erl index a5eb6d0413..139267d32b 100644 --- a/lib/asn1/src/asn1ct_table.erl +++ b/lib/asn1/src/asn1ct_table.erl @@ -31,7 +31,7 @@ -export([lookup/2]). -export([match/2]). -export([to_list/1]). --export([delete/1]). % TODO: Remove (since we run in a separate process) +-export([delete/1]). %% Always creates a new table @@ -63,14 +63,17 @@ match(Table, MatchSpec) -> ets:match(get(Table), MatchSpec). to_list(Table) -> ets:tab2list(get(Table)). +%% Deleting tables is no longer strictly necessary since each compilation +%% runs in separate process, but it will reduce memory consumption +%% especially when many compilations are run in parallel. + delete(Tables) when is_list(Tables) -> [delete(T) || T <- Tables], true; delete(Table) when is_atom(Table) -> - case get(Table) of + case erase(Table) of undefined -> true; TableId -> - ets:delete(TableId), - erase(Table) + ets:delete(TableId) end. |