aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Larsson <[email protected]>2011-06-30 17:57:37 +0200
committerLukas Larsson <[email protected]>2011-06-30 17:59:44 +0200
commit6f9e2029f780ed6fb2deef1dd7f78b84b090b488 (patch)
tree4b513515d88d1fe4244f52c0d1a77e749b021fe3
parent256391d4f9b7425fd96b5b9f344b212751bdfda2 (diff)
downloadotp-6f9e2029f780ed6fb2deef1dd7f78b84b090b488.tar.gz
otp-6f9e2029f780ed6fb2deef1dd7f78b84b090b488.tar.bz2
otp-6f9e2029f780ed6fb2deef1dd7f78b84b090b488.zip
Remove extra allocated heap fragment
-rw-r--r--erts/emulator/beam/erl_nif.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_nif.c b/erts/emulator/beam/erl_nif.c
index d1afeb4f03..0f0790f8bb 100644
--- a/erts/emulator/beam/erl_nif.c
+++ b/erts/emulator/beam/erl_nif.c
@@ -1008,15 +1008,14 @@ void enif_system_info(ErlNifSysInfo *sip, size_t si_size)
}
int enif_get_reverse_list(ErlNifEnv* env, ERL_NIF_TERM term, ERL_NIF_TERM *list) {
- Eterm *listptr, *ret, *hp;
+ Eterm *listptr, ret = NIL, *hp;
if (is_nil(term)) {
*list = term;
return 1;
}
- ret = alloc_heap(env, 2);
- *ret = NIL;
+ ret = NIL;
while (is_not_nil(term)) {
if (is_not_list(term)) {
@@ -1024,10 +1023,10 @@ int enif_get_reverse_list(ErlNifEnv* env, ERL_NIF_TERM term, ERL_NIF_TERM *list)
}
hp = alloc_heap(env, 2);
listptr = list_val(term);
- *ret = CONS(hp, CAR(listptr), *ret);
+ ret = CONS(hp, CAR(listptr), ret);
term = CDR(listptr);
}
- *list = *ret;
+ *list = ret;
return 1;
}