diff options
author | Sverker Eriksson <[email protected]> | 2013-01-11 17:27:29 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2013-01-18 15:04:03 +0100 |
commit | b553664f54034e8c04ae6f9cc44f16b7f516518b (patch) | |
tree | 1522c655fea9aa52476e997aa26f1512d3ecada4 /lib/erl_interface/src/encode/encode_ref.c | |
parent | 97abb095cd2182d5c3fafd525da4943ef74dc8e5 (diff) | |
download | otp-b553664f54034e8c04ae6f9cc44f16b7f516518b.tar.gz otp-b553664f54034e8c04ae6f9cc44f16b7f516518b.tar.bz2 otp-b553664f54034e8c04ae6f9cc44f16b7f516518b.zip |
erl_interface: utf8 atoms continued
Diffstat (limited to 'lib/erl_interface/src/encode/encode_ref.c')
-rw-r--r-- | lib/erl_interface/src/encode/encode_ref.c | 24 |
1 files changed, 10 insertions, 14 deletions
diff --git a/lib/erl_interface/src/encode/encode_ref.c b/lib/erl_interface/src/encode/encode_ref.c index 292b452864..e8b3173315 100644 --- a/lib/erl_interface/src/encode/encode_ref.c +++ b/lib/erl_interface/src/encode/encode_ref.c @@ -24,36 +24,32 @@ int ei_encode_ref(char *buf, int *index, const erlang_ref *p) { char *s = buf + *index; - char *s0 = s; - int len = strlen(p->node); int i; + (*index) += 1 + 2; /* skip to node atom */ + if (ei_encode_atom_len_as(buf, index, p->node, strlen(p->node), ERLANG_UTF8, + p->node_org_enc) < 0) { + return -1; + } + /* Always encode as an extended reference; all participating parties are now expected to be able to decode extended references. */ - if (!buf) s += 1 + 2 + (3+len) + p->len*4 + 1; - else { + if (buf) { put8(s,ERL_NEW_REFERENCE_EXT); /* first, number of integers */ put16be(s, p->len); /* then the nodename */ - put8(s,ERL_ATOM_EXT); - - put16be(s,len); - - memmove(s, p->node, len); - s += len; + s = buf + *index; /* now the integers */ put8(s,(p->creation & 0x03)); for (i = 0; i < p->len; i++) put32be(s,p->n[i]); - - } - - *index += s-s0; + } + *index += p->len*4 + 1; return 0; } |