File turtle_janitor-replace-maps-take-2-for-comatibility-.patch of Package turtle
From 6b8d6776addd3e49f099eb0350c766cd7e196aa5 Mon Sep 17 00:00:00 2001
From: Led <ledest@gmail.com>
Date: Tue, 17 Oct 2017 14:19:45 +0300
Subject: [PATCH] turtle_janitor: replace maps:take/2 for comatibility of
Erlang/OTP 18
---
src/turtle_janitor.erl | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/turtle_janitor.erl b/src/turtle_janitor.erl
index 44bd6bc..5830679 100644
--- a/src/turtle_janitor.erl
+++ b/src/turtle_janitor.erl
@@ -137,11 +137,11 @@ cleanup(not_found, _Reason) ->
ok.
bimap_take(X, Map) ->
- case maps:take(X, Map) of
- error ->
- {not_found, Map};
- {Val, Map2} ->
- {Val, maps:remove(Val, Map2)}
+ case Map of
+ #{X := Val} ->
+ {Val, maps:without([X, Val], Map)};
+ #{} ->
+ {not_found, Map}
end.
bimap_put(X, Y, Map) ->
--
2.14.2