aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam/erl_nif.c
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2018-01-04 19:04:09 +0100
committerSverker Eriksson <[email protected]>2018-01-05 14:40:04 +0100
commitf0123ff032ea2f9b4aa30322ad476e3f79757e79 (patch)
tree3133565d4c5530d546008a49fa8b62c35d8122e2 /erts/emulator/beam/erl_nif.c
parentf496717590d610bd08f02bec39f8e97886c68729 (diff)
downloadotp-f0123ff032ea2f9b4aa30322ad476e3f79757e79.tar.gz
otp-f0123ff032ea2f9b4aa30322ad476e3f79757e79.tar.bz2
otp-f0123ff032ea2f9b4aa30322ad476e3f79757e79.zip
erts: Refactor more usage of erts_build_proc_bin
Diffstat (limited to 'erts/emulator/beam/erl_nif.c')
-rw-r--r--erts/emulator/beam/erl_nif.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index f67b67325d..682df1021c 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -1343,21 +1343,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;