From: Ivan Maidanski Date: Tue, 23 Oct 2012 04:46:38 +0000 (+0400) Subject: Minimize code duplication in GC_mark_and_push X-Git-Tag: gc7_4_0~180 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c7ddccb3cf540d0345fe79ef15ec6da987c8d786;p=gc 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). --- 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,