Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:Ledest:erlang:23
erlang
2725-Slightly-simplify-maps-intersection-functi...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 2725-Slightly-simplify-maps-intersection-functions.patch of Package erlang
From 605ddf317d8f2d3c269e07c0b412dc66d8197525 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org> Date: Mon, 23 Aug 2021 12:24:25 +0200 Subject: [PATCH] Slightly simplify maps intersection functions The helper function `intersect_with_iterate()` used by `maps:intersect/2` and `maps:intersect_with/3` passes around an argument that is ultimately never used. Eliminate it. --- lib/stdlib/src/maps.erl | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/stdlib/src/maps.erl b/lib/stdlib/src/maps.erl index dbdd1ae5b7..236991c54b 100644 --- a/lib/stdlib/src/maps.erl +++ b/lib/stdlib/src/maps.erl @@ -119,18 +119,18 @@ intersect_with(Combiner, Map1, Map2) -> intersect_with_small_map_first(Combiner, SmallMap, BigMap) -> Next = maps:next(maps:iterator(SmallMap)), - intersect_with_iterate(Next, [], SmallMap, BigMap, Combiner). + intersect_with_iterate(Next, [], BigMap, Combiner). -intersect_with_iterate({K, V1, Iterator}, Keep, Map1, Map2, Combiner) -> +intersect_with_iterate({K, V1, Iterator}, Keep, BigMap, Combiner) -> Next = maps:next(Iterator), - case Map2 of + case BigMap of #{ K := V2 } -> V = Combiner(K, V1, V2), - intersect_with_iterate(Next, [{K,V}|Keep], Map1, Map2, Combiner); + intersect_with_iterate(Next, [{K,V}|Keep], BigMap, Combiner); _ -> - intersect_with_iterate(Next, Keep, Map1, Map2, Combiner) + intersect_with_iterate(Next, Keep, BigMap, Combiner) end; -intersect_with_iterate(none, Keep, _Map1, _Map2, _Combiner) -> +intersect_with_iterate(none, Keep, _BigMap2, _Combiner) -> maps:from_list(Keep). %% Shadowed by erl_bif_types: maps:is_key/2 -- 2.31.1
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor