From b51872b742b18bcb0c53aaeb09713a46ec91f788 Mon Sep 17 00:00:00 2001 From: Anders Svensson Date: Sun, 16 Apr 2017 18:47:05 +0200 Subject: Remove minor encode bloat As when detecting missing AVPs, extract a list of field/value pairs in one step, which looks to be slightly more efficient. Flattening the list was unnecessary since the result is passed to list_to_binary. --- lib/diameter/include/diameter_gen.hrl | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'lib/diameter/include') diff --git a/lib/diameter/include/diameter_gen.hrl b/lib/diameter/include/diameter_gen.hrl index f8d6cbde89..e745e3d2d3 100644 --- a/lib/diameter/include/diameter_gen.hrl +++ b/lib/diameter/include/diameter_gen.hrl @@ -104,8 +104,7 @@ encode_avps(Name, Rec) -> %% encode/2 encode(Name, Rec) -> - lists:flatmap(fun(A) -> encode(Name, A, '#get-'(A, Rec)) end, - '#info-'(element(1, Rec), fields)). + [encode(Name, F, V) || {F,V} <- '#get-'(Rec)]. %% encode/3 -- cgit v1.2.3