diff options
author | Sverker Eriksson <[email protected]> | 2016-02-12 18:52:20 +0100 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2016-03-29 14:57:11 +0200 |
commit | a2a86dadc648dda68b5221a7c1d83b9238be1e25 (patch) | |
tree | 6229f416cc8a8e8a4b413a3a91246e37a693ff3a /erts/emulator/beam/external.c | |
parent | 209c5cf22b5cdc70eb48e6afdcddfa7132471aab (diff) | |
download | otp-a2a86dadc648dda68b5221a7c1d83b9238be1e25.tar.gz otp-a2a86dadc648dda68b5221a7c1d83b9238be1e25.tar.bz2 otp-a2a86dadc648dda68b5221a7c1d83b9238be1e25.zip |
erts: Improve enif_binary_to_term
* Accept a raw data buffer instead of ErlNifBinary
* Accept option ERL_NIF_BIN2TERM_SAFE
* Return number of read bytes
Diffstat (limited to 'erts/emulator/beam/external.c')
-rw-r--r-- | erts/emulator/beam/external.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c index aac1490f0c..f5eb13421d 100644 --- a/erts/emulator/beam/external.c +++ b/erts/emulator/beam/external.c @@ -967,15 +967,23 @@ erts_decode_dist_ext(ErtsHeapFactory* factory, return THE_NON_VALUE; } -Eterm erts_decode_ext(ErtsHeapFactory* factory, byte **ext) +Eterm erts_decode_ext(ErtsHeapFactory* factory, byte **ext, Uint32 flags) { + ErtsDistExternal ede, *edep; Eterm obj; byte *ep = *ext; if (*ep++ != VERSION_MAGIC) { erts_factory_undo(factory); return THE_NON_VALUE; } - ep = dec_term(NULL, factory, ep, &obj, NULL); + if (flags) { + ASSERT(flags == ERTS_DIST_EXT_BTT_SAFE); + ede.flags = flags; /* a dummy struct just for the flags */ + edep = &ede; + } else { + edep = NULL; + } + ep = dec_term(edep, factory, ep, &obj, NULL); if (!ep) { #ifdef DEBUG bin_write(ERTS_PRINT_STDERR,NULL,*ext,500); |