diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2016-01-16 01:30:22 +0100 |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2016-01-16 01:30:22 +0100 |
commit | 63777f830d912bb129e32242a23b74d917b6f080 (patch) | |
tree | c40c81ba7309149989a10fe4836e309bf4cc9c60 /src/mod_http_upload.erl | |
parent | Merge pull request #906 from hamano/stats_processes (diff) |
Use maps instead of dicts in HTTP upload modules
ejabberd currently depends on Erlang/OTP 17.1 or higher, so we can now
use maps.
Diffstat (limited to 'src/mod_http_upload.erl')
-rw-r--r-- | src/mod_http_upload.erl | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mod_http_upload.erl b/src/mod_http_upload.erl index a5e8e172..36d3626b 100644 --- a/src/mod_http_upload.erl +++ b/src/mod_http_upload.erl @@ -108,7 +108,7 @@ get_url :: binary(), service_url :: binary() | undefined, thumbnail :: boolean(), - slots = dict:new() :: term()}). % dict:dict() requires Erlang 17. + slots = #{} :: map()}). -record(media_info, {type :: binary(), @@ -676,18 +676,18 @@ create_slot(#state{service_url = ServiceURL}, -spec add_slot(slot(), pos_integer(), timer:tref(), state()) -> state(). add_slot(Slot, Size, Timer, #state{slots = Slots} = State) -> - NewSlots = dict:store(Slot, {Size, Timer}, Slots), + NewSlots = maps:put(Slot, {Size, Timer}, Slots), State#state{slots = NewSlots}. -spec get_slot(slot(), state()) -> {ok, {pos_integer(), timer:tref()}} | error. get_slot(Slot, #state{slots = Slots}) -> - dict:find(Slot, Slots). + maps:find(Slot, Slots). -spec del_slot(slot(), state()) -> state(). del_slot(Slot, #state{slots = Slots} = State) -> - NewSlots = dict:erase(Slot, Slots), + NewSlots = maps:remove(Slot, Slots), State#state{slots = NewSlots}. -spec slot_el(slot() | binary(), state() | binary(), binary()) -> xmlel(). |