From 36a64980960077558dcfd0e181a65753856f331c Mon Sep 17 00:00:00 2001
From: Anders Svensson <anders@erlang.org>
Date: Thu, 31 Aug 2017 09:53:45 +0200
Subject: Rename decode_format false to none

Which reads better and makes it easier to distinguish this false from
others.
---
 lib/diameter/doc/src/diameter.xml            |  8 ++++----
 lib/diameter/src/base/diameter.erl           |  2 +-
 lib/diameter/src/base/diameter_config.erl    |  4 ++--
 lib/diameter/src/base/diameter_gen.erl       | 11 ++++++-----
 lib/diameter/src/base/diameter_watchdog.erl  |  4 ++--
 lib/diameter/test/diameter_traffic_SUITE.erl |  8 ++++----
 6 files changed, 19 insertions(+), 18 deletions(-)

diff --git a/lib/diameter/doc/src/diameter.xml b/lib/diameter/doc/src/diameter.xml
index c31929c3f0..0169afb619 100644
--- a/lib/diameter/doc/src/diameter.xml
+++ b/lib/diameter/doc/src/diameter.xml
@@ -799,7 +799,7 @@ be matched by corresponding &capability; configuration, of
 
 <tag>
 <marker id="decode_format"/>
-<c>{decode_format, record | list | map | false}</c></tag>
+<c>{decode_format, record | list | map | none}</c></tag>
 <item>
 <p>
 The format of decoded messages and grouped AVPs in the <c>msg</c> field
@@ -808,10 +808,10 @@ records respectively.
 If <c>record</c> then a record whose definition is generated from the
 dictionary file in question.
 If <c>list</c> or <c>map</c> then a <c>[Name | Avps]</c> pair where
-<c>Avps</c> is either a list of AVP name/values pairs or a map keyed on
+<c>Avps</c> is a list of AVP name/values pairs or a map keyed on
 AVP names respectively.
-If <c>false</c> then the representation is as the atom-value message
-name, or <c>undefined</c> for a Grouped AVP.
+If <c>none</c> then the atom-value message name, or <c>undefined</c>
+for a Grouped AVP.
 See also &codec_message;.</p>
 
 <p>
diff --git a/lib/diameter/src/base/diameter.erl b/lib/diameter/src/base/diameter.erl
index 3b41feac0d..69ef6f4ec0 100644
--- a/lib/diameter/src/base/diameter.erl
+++ b/lib/diameter/src/base/diameter.erl
@@ -340,7 +340,7 @@ call(SvcName, App, Message) ->
    :: record
     | list
     | map
-    | false
+    | none
     | record_from_map.
 
 -type strict_arities()
diff --git a/lib/diameter/src/base/diameter_config.erl b/lib/diameter/src/base/diameter_config.erl
index 6fc4277ac8..284f885884 100644
--- a/lib/diameter/src/base/diameter_config.erl
+++ b/lib/diameter/src/base/diameter_config.erl
@@ -588,8 +588,7 @@ opt(service, {K, false})
        K == use_shared_peers;
        K == monitor;
        K == restrict_connections;
-       K == strict_arities;
-       K == decode_format ->
+       K == strict_arities ->
     true;
 
 opt(service, {K, true})
@@ -602,6 +601,7 @@ opt(service, {decode_format, T})
   when T == record;
        T == list;
        T == map;
+       T == none;
        T == record_from_map ->
     true;
 
diff --git a/lib/diameter/src/base/diameter_gen.erl b/lib/diameter/src/base/diameter_gen.erl
index e8f637dd53..0aea982a54 100644
--- a/lib/diameter/src/base/diameter_gen.erl
+++ b/lib/diameter/src/base/diameter_gen.erl
@@ -527,7 +527,7 @@ decode1(Data, Name, {AvpName, Type}, Mod, Fmt, Opts, Avp) ->
 
 %% set/4
 
-set('Grouped', false, Avp, V) ->
+set('Grouped', none, Avp, V) ->
     {_Rec, As} = V,
     [Avp | As];
 
@@ -542,7 +542,7 @@ set(_, _, Avp, V) ->
 %%
 %% Error when decoding a grouped AVP.
 
-decode_error(true, false, _, Avp) ->
+decode_error(true, none, _, Avp) ->
     Avp;
 
 decode_error(true, _, {Rec, _, _}, Avp) ->
@@ -735,8 +735,9 @@ pack(Arity, F, Avp, Mod, [Failed | Rec]) ->
 
 %% set/5
 
-set(_, _, _, _, false = No) ->
-    No;
+set(_, _, _, _, None)
+  when is_atom(None) ->
+    None;
 
 set(1, F, Value, _, Map)
   when is_map(Map) ->
@@ -830,7 +831,7 @@ empty(Name, #{module := Mod} = Opts) ->
 
 %% newrec/4
 
-newrec(false, _, Name, _) ->
+newrec(none, _, Name, _) ->
     Name;
 
 newrec(record, Mod, Name, T)
diff --git a/lib/diameter/src/base/diameter_watchdog.erl b/lib/diameter/src/base/diameter_watchdog.erl
index bb671e9860..c08e2da672 100644
--- a/lib/diameter/src/base/diameter_watchdog.erl
+++ b/lib/diameter/src/base/diameter_watchdog.erl
@@ -72,7 +72,7 @@
                      restrict := boolean(),
                      suspect := non_neg_integer(), %% OKAY -> SUSPECT
                      okay := non_neg_integer()},   %% REOPEN -> OKAY
-         codec :: #{decode_format := false,
+         codec :: #{decode_format := none,
                     string_decode := false,
                     strict_arities => diameter:strict_arities(),
                     strict_mbit := boolean(),
@@ -157,7 +157,7 @@ i({Ack, T, Pid, {Opts,
                                  string_decode,
                                  rfc,
                                  ordered_encode],
-                                SvcOpts#{decode_format := false,
+                                SvcOpts#{decode_format := none,
                                          string_decode := false,
                                          ordered_encode => false})}.
 
diff --git a/lib/diameter/test/diameter_traffic_SUITE.erl b/lib/diameter/test/diameter_traffic_SUITE.erl
index 403d417636..559ec14c2b 100644
--- a/lib/diameter/test/diameter_traffic_SUITE.erl
+++ b/lib/diameter/test/diameter_traffic_SUITE.erl
@@ -154,7 +154,7 @@
 -define(ENCODINGS, [list, record, map]).
 
 %% How to decode incoming messages.
--define(DECODINGS, [record, false, map, list, record_from_map]).
+-define(DECODINGS, [record, none, map, list, record_from_map]).
 
 %% Which dictionary to use in the clients.
 -define(RFCS, [rfc3588, rfc6733, rfc4005]).
@@ -1109,12 +1109,12 @@ origin(N) ->
 decode(record) -> 0;
 decode(list)   -> 1;
 decode(map)    -> 2;
-decode(false)  -> 3;
+decode(none)   -> 3;
 decode(record_from_map) -> 4;
 decode(0) -> record;
 decode(1) -> list;
 decode(2) -> map;
-decode(3) -> false;
+decode(3) -> none;
 decode(4) -> record_from_map.
 
 encode(record) -> 0;
@@ -1163,7 +1163,7 @@ to_map(#diameter_packet{header = H, msg = Rec},
 to_map(#diameter_packet{header = H,
                         msg = Name,
                         bin = Bin},
-      #group{server_decoding = false,
+      #group{server_decoding = none,
              strings = B}) ->
     Opts = #{decode_format => map,
              string_decode => B,
-- 
cgit v1.2.3