From: Ivan Maidanski Date: Sun, 15 Dec 2013 17:03:17 +0000 (+0400) Subject: Eliminate redundant *flh check for null in GC_allocobj X-Git-Tag: gc7_6_0~304 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=128769a801d17e82b0d10f946eb8cab2870468be;p=gc Eliminate redundant *flh check for null in GC_allocobj (code refactoring) * alloc.c (GC_allocobj): Do not check *flh twice if the value is non-NULL (GC_new_hblk is not called thus *flh stays non-NULL in that case). --- diff --git a/alloc.c b/alloc.c index f0b1c11f..153ff0e9 100644 --- a/alloc.c +++ b/alloc.c @@ -1337,21 +1337,21 @@ GC_INNER ptr_t GC_allocobj(size_t gran, int kind) EXIT_GC(); if (*flh == 0) { GC_new_hblk(gran, kind); - } - if (*flh == 0) { - ENTER_GC(); - if (GC_incremental && GC_time_limit == GC_TIME_UNLIMITED - && !tried_minor) { - GC_collect_a_little_inner(1); - tried_minor = TRUE; - } else { - if (!GC_collect_or_expand(1, FALSE, retry)) { - EXIT_GC(); - return(0); + if (*flh == 0) { + ENTER_GC(); + if (GC_incremental && GC_time_limit == GC_TIME_UNLIMITED + && !tried_minor) { + GC_collect_a_little_inner(1); + tried_minor = TRUE; + } else { + if (!GC_collect_or_expand(1, FALSE, retry)) { + EXIT_GC(); + return(0); + } + retry = TRUE; } - retry = TRUE; + EXIT_GC(); } - EXIT_GC(); } } /* Successful allocation; reset failure count. */