From 128769a801d17e82b0d10f946eb8cab2870468be Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sun, 15 Dec 2013 21:03:17 +0400 Subject: [PATCH] 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). --- alloc.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) 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. */ -- 2.40.0