aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface
diff options
context:
space:
mode:
Diffstat (limited to 'lib/erl_interface')
-rw-r--r--lib/erl_interface/doc/src/ei.xml18
-rw-r--r--lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c5
2 files changed, 11 insertions, 12 deletions
diff --git a/lib/erl_interface/doc/src/ei.xml b/lib/erl_interface/doc/src/ei.xml
index 1756ee8a7d..90495eebd6 100644
--- a/lib/erl_interface/doc/src/ei.xml
+++ b/lib/erl_interface/doc/src/ei.xml
@@ -422,19 +422,18 @@ ei_x_encode_empty_list(&x);
<fsummary>Encode a map</fsummary>
<desc>
<p>This function encodes a map header, with a specified arity. The next
- <c>arity</c> terms encoded will be the keys of the map, and the next
- <c>arity</c> terms after that will be the corresponding values in
- same order.</p>
+ <c>arity*2</c> terms encoded will be the keys and values of the map
+ encoded in the following order: <c>K1, V1, K2, V2, ..., Kn, Vn</c>.
+ </p>
<p>E.g. to encode the map <c>#{a => "Apple", b => "Banana"}</c>:</p>
<pre>
ei_x_encode_map_header(&amp;x, 2);
ei_x_encode_atom(&amp;x, "a");
-ei_x_encode_atom(&amp;x, "b");
ei_x_encode_string(&amp;x, "Apple");
+ei_x_encode_atom(&amp;x, "b");
ei_x_encode_string(&amp;x, "Banana");
</pre>
- <p>A correctly encoded map can not have duplicate keys, but no check
- for duplicate keys is done by this function.</p>
+ <p>A correctly encoded map can not have duplicate keys.</p>
</desc>
</func>
<func>
@@ -664,10 +663,9 @@ ei_x_encode_string(&amp;x, "Banana");
<desc>
<p>This function decodes a map header from the binary
format. The number of key-value pairs is returned in
- <c>arity</c>. Keys and values follows, first all keys and then all values,
- which makes a total of <c>arity*2</c> terms.
- Keys and values are paired according to their order, the first key
- with the first value and so on. If <c>arity</c> is zero, it's an empty map.
+ <c>*arity</c>. Keys and values follow in the following order:
+ <c>K1, V1, K2, V2, ..., Kn, Vn</c>. This makes a total of
+ <c>arity*2</c> terms. If <c>arity</c> is zero, it's an empty map.
A correctly encoded map does not have duplicate keys.</p>
</desc>
</func>
diff --git a/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c b/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c
index 790d498a1d..fcf546105b 100644
--- a/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c
+++ b/lib/erl_interface/test/ei_decode_encode_SUITE_data/ei_decode_encode_test.c
@@ -527,8 +527,9 @@ TESTCASE(test_ei_decode_encode)
{ /* #{atom => atom, atom => pid, port => ref }*/
struct Type* map[] = { &map_type,
- &my_atom_type, &my_atom_type, &port_type,
- &my_atom_type, &pid_type, &ref_type
+ &my_atom_type, &my_atom_type,
+ &my_atom_type, &pid_type,
+ &port_type, &ref_type
};
decode_encode(map, 7);
}