diff options
author | Linus Nordberg <linus@nordu.net> | 2016-07-12 17:50:14 +0200 |
---|---|---|
committer | Linus Nordberg <linus@nordu.net> | 2016-07-12 17:50:14 +0200 |
commit | c936af7ba6b8ef05e999bd431896b0a7065f566b (patch) | |
tree | b8348af1c59f2137bf7d4e25b88d472e30d14a17 | |
parent | 8c48a13e1f996b5aa49497031737dee6818dc331 (diff) |
Take default value as an argument instead of using 0.
-rw-r--r-- | src/frontend.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/frontend.erl b/src/frontend.erl index 3dbf3af..c0cf3a8 100644 --- a/src/frontend.erl +++ b/src/frontend.erl @@ -338,19 +338,20 @@ create_first_unknown_cache_table() -> end, ets:new(?FIRST_UNKNOWN_CACHE_TABLE, [set, public, named_table]). -first_unknown_cache() -> +first_unknown_cache(DefaultValue) -> case ets:lookup(?FIRST_UNKNOWN_CACHE_TABLE, first_unknown_cache) of [{_, Size}] -> Size; [] -> - 0 + DefaultValue end. set_first_unknown_cache(Size) -> - CurrentSize = first_unknown_cache(), + CurrentSize = first_unknown_cache(0), if Size == CurrentSize + 1 -> - true = ets:insert(?FIRST_UNKNOWN_CACHE_TABLE, {first_unknown_cache, Size}); + true = ets:insert(?FIRST_UNKNOWN_CACHE_TABLE, + {first_unknown_cache, Size}); true -> ok end, |