diff options
author | Sverker Eriksson <[email protected]> | 2018-01-16 15:02:26 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2018-01-16 15:02:26 +0100 |
commit | b02208125f27b20e6ce186afcdc6b79e24ac732a (patch) | |
tree | d882dcccfee7cdd7faf0a4172758d2303732ec16 /erts/emulator/beam/erl_nif.c | |
parent | 0841f405cdce1392a4d8975618c4e0895eb8a6b7 (diff) | |
parent | f0123ff032ea2f9b4aa30322ad476e3f79757e79 (diff) | |
download | otp-b02208125f27b20e6ce186afcdc6b79e24ac732a.tar.gz otp-b02208125f27b20e6ce186afcdc6b79e24ac732a.tar.bz2 otp-b02208125f27b20e6ce186afcdc6b79e24ac732a.zip |
Merge branch 'sverker/build-proc-bin'
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r-- | erts/emulator/beam/erl_nif.c | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c index 0a5fe026db..94ebf88b56 100644 --- a/erts/emulator/beam/erl_nif.c +++ b/erts/emulator/beam/erl_nif.c @@ -1317,21 +1317,11 @@ Eterm enif_make_binary(ErlNifEnv* env, ErlNifBinary* bin) } else if (bin->ref_bin != NULL) { Binary* bptr = bin->ref_bin; - ProcBin* pb; Eterm bin_term; - /* !! Copy-paste from new_binary() !! */ - pb = (ProcBin *) alloc_heap(env, PROC_BIN_SIZE); - pb->thing_word = HEADER_PROC_BIN; - pb->size = bptr->orig_size; - pb->next = MSO(env->proc).first; - MSO(env->proc).first = (struct erl_off_heap_header*) pb; - pb->val = bptr; - pb->bytes = (byte*) bptr->orig_bytes; - pb->flags = 0; - - OH_OVERHEAD(&(MSO(env->proc)), pb->size / sizeof(Eterm)); - bin_term = make_binary(pb); + bin_term = erts_build_proc_bin(&MSO(env->proc), + alloc_heap(env, PROC_BIN_SIZE), + bptr); if (erts_refc_read(&bptr->intern.refc, 1) == 1) { /* Total ownership transfer */ bin->ref_bin = NULL; |