From c7ddccb3cf540d0345fe79ef15ec6da987c8d786 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Tue, 23 Oct 2012 08:46:38 +0400 Subject: [PATCH] Minimize code duplication in GC_mark_and_push * mark.c (GC_mark_and_push): Minimize code duplication (regarding GC_ADD_TO_BLACK_LIST_NORMAL call) and eliminate "nested checking of GC_all_interior_pointers value" warning (issued by some code analysis tools). --- mark.c | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/mark.c b/mark.c index 91081b6e..451673d2 100644 --- a/mark.c +++ b/mark.c @@ -1375,21 +1375,12 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj, PREFETCH(obj); GET_HDR(obj, hhdr); - if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)) { - if (GC_all_interior_pointers) { - hhdr = GC_find_header(GC_base(obj)); - if (hhdr == 0) { - GC_ADD_TO_BLACK_LIST_NORMAL(obj, (ptr_t)src); - return mark_stack_ptr; - } - } else { - GC_ADD_TO_BLACK_LIST_NORMAL(obj, (ptr_t)src); - return mark_stack_ptr; - } - } - if (EXPECT(HBLK_IS_FREE(hhdr), FALSE)) { - GC_ADD_TO_BLACK_LIST_NORMAL(obj, (ptr_t)src); - return mark_stack_ptr; + if ((EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE) + && (!GC_all_interior_pointers + || NULL == (hhdr = GC_find_header(GC_base(obj))))) + || EXPECT(HBLK_IS_FREE(hhdr), FALSE)) { + GC_ADD_TO_BLACK_LIST_NORMAL(obj, (ptr_t)src); + return mark_stack_ptr; } PUSH_CONTENTS_HDR(obj, mark_stack_ptr /* modified */, mark_stack_limit, -- 2.40.0