LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File 1372-Clarify-a-magical-allocation-size.patch of Package erlang (Project home:Ledest:erlang:20)

From 0aad6ef3bf360f2971d5c8b22620aecc3cdae3ef Mon Sep 17 00:00:00 2001
From: Dmytro Lytovchenko <dmytro.lytovchenko@erlang-solutions.com>
Date: Tue, 23 Oct 2018 09:14:11 +0200
Subject: [PATCH 2/4] Clarify a magical allocation size

---
 erts/emulator/beam/external.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/erts/emulator/beam/external.c b/erts/emulator/beam/external.c
index 621ba108ba..9a66e491f3 100644
--- a/erts/emulator/beam/external.c
+++ b/erts/emulator/beam/external.c
@@ -1953,7 +1953,8 @@ static Eterm erts_term_to_binary_int(Process* p, Eterm Term, int level, Uint fla
 
 #define RETURN_STATE()							\
     do {								\
-	hp = HAlloc(p, ERTS_MAGIC_REF_THING_SIZE+3);                    \
+	static const int TUPLE2_SIZE = 2 + 1;				\
+	hp = HAlloc(p, ERTS_MAGIC_REF_THING_SIZE + TUPLE2_SIZE);        \
 	c_term = erts_mk_magic_ref(&hp, &MSO(p), context_b);            \
 	res = TUPLE2(hp, Term, c_term);					\
 	BUMP_ALL_REDS(p);                                               \
-- 
2.16.4