aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/decode
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2014-03-06 15:13:34 +0100
committerSverker Eriksson <[email protected]>2014-03-06 20:10:19 +0100
commit6941af88ad016141f568279f065cb181074f1f9f (patch)
treebadef0333dd52b55a523f89d01a932a658e2f88c /lib/erl_interface/src/decode
parent453cba0046ec8363a4c3cea97ce22a6f4ff0b75a (diff)
downloadotp-6941af88ad016141f568279f065cb181074f1f9f.tar.gz
otp-6941af88ad016141f568279f065cb181074f1f9f.tar.bz2
otp-6941af88ad016141f568279f065cb181074f1f9f.zip
erl_interface: Add ei encode/decode for maps
Diffstat (limited to 'lib/erl_interface/src/decode')
-rw-r--r--lib/erl_interface/src/decode/decode_tuple_header.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/lib/erl_interface/src/decode/decode_tuple_header.c b/lib/erl_interface/src/decode/decode_tuple_header.c
index c0ba14ea47..698be1b97a 100644
--- a/lib/erl_interface/src/decode/decode_tuple_header.c
+++ b/lib/erl_interface/src/decode/decode_tuple_header.c
@@ -1,7 +1,7 @@
/*
* %CopyrightBegin%
*
- * Copyright Ericsson AB 1998-2009. All Rights Reserved.
+ * Copyright Ericsson AB 1998-2014. All Rights Reserved.
*
* The contents of this file are subject to the Erlang Public License,
* Version 1.1, (the "License"); you may not use this file except in
@@ -45,3 +45,24 @@ int ei_decode_tuple_header(const char *buf, int *index, int *arity)
return 0;
}
+
+int ei_decode_map_header(const char *buf, int *index, int *arity)
+{
+ const char *s = buf + *index;
+ const char *s0 = s;
+ int i;
+
+ switch ((i=get8(s))) {
+ case ERL_MAP_EXT:
+ if (arity) *arity = get32be(s);
+ else s += 4;
+ break;
+
+ default:
+ return -1;
+ }
+
+ *index += s-s0;
+
+ return 0;
+}