]> granicus.if.org Git - gc/commitdiff
Eliminate redundant *flh check for null in GC_allocobj
authorIvan Maidanski <ivmai@mail.ru>
Sun, 15 Dec 2013 17:03:17 +0000 (21:03 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Sun, 15 Dec 2013 17:03:48 +0000 (21:03 +0400)
(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

diff --git a/alloc.c b/alloc.c
index f0b1c11facdc95620cbee9188e8b3a287e738166..153ff0e9f1b582537f121010c129386760740b01 100644 (file)
--- 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.      */