From 888b7da8d2c504ab0f5d0163a58c6e29f5f86f22 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Wed, 16 May 2018 11:49:33 +0300 Subject: Remove code duplication in gcj_malloc and malloc_explicitly_typed (code refactoring) * gcj_mlc.c [GC_GCJ_SUPPORT] (GC_gcj_malloc): Store ptr_to_struct_containing_descr in a single place of code. * typd_mlc.c (GC_malloc_explicitly_typed_ignore_off_page): Store d (to the object) in a single place of code. --- gcj_mlc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'gcj_mlc.c') diff --git a/gcj_mlc.c b/gcj_mlc.c index 35b3d3f1..552520c6 100644 --- a/gcj_mlc.c +++ b/gcj_mlc.c @@ -180,9 +180,7 @@ static void maybe_finalize(void) GC_gcjobjfreelist[lg] = (ptr_t)obj_link(op); GC_bytes_allocd += GRANULES_TO_BYTES((word)lg); } - *(void **)op = ptr_to_struct_containing_descr; GC_ASSERT(((void **)op)[1] == 0); - UNLOCK(); } else { LOCK(); maybe_finalize(); @@ -192,9 +190,9 @@ static void maybe_finalize(void) UNLOCK(); return((*oom_fn)(lb)); } - *(void **)op = ptr_to_struct_containing_descr; - UNLOCK(); } + *(void **)op = ptr_to_struct_containing_descr; + UNLOCK(); return((void *) op); } -- cgit v1.2.1