]> granicus.if.org Git - gc/commitdiff
Refactoring of mark_and_push_stack (check GC_base result for null)
authorIvan Maidanski <ivmai@mail.ru>
Wed, 9 Mar 2016 20:12:25 +0000 (23:12 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 9 Mar 2016 20:12:25 +0000 (23:12 +0300)
* mark.c (GC_mark_and_push_stack): Check GC_base() result (do not pass
NULL to HDR()).

mark.c

diff --git a/mark.c b/mark.c
index de57bec14e0c8be8c4ef3cd65164c0cef04fc03b..37de535d4556dc24df7af2d25b72a1307299955c 100644 (file)
--- a/mark.c
+++ b/mark.c
@@ -1436,15 +1436,12 @@ GC_API struct GC_ms_entry * GC_CALL GC_mark_and_push(void *obj,
 
     PREFETCH(p);
     GET_HDR(p, hhdr);
-    if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)) {
-        if (hhdr != 0) {
-          r = GC_base(p);
-          hhdr = HDR(r);
-        }
-        if (hhdr == 0) {
-            GC_ADD_TO_BLACK_LIST_STACK(p, source);
-            return;
-        }
+    if (EXPECT(IS_FORWARDING_ADDR_OR_NIL(hhdr), FALSE)
+        && (NULL == hhdr
+            || (r = GC_base(p)) == NULL
+            || (hhdr = HDR(r)) == NULL)) {
+        GC_ADD_TO_BLACK_LIST_STACK(p, source);
+        return;
     }
     if (EXPECT(HBLK_IS_FREE(hhdr), FALSE)) {
         GC_ADD_TO_BLACK_LIST_NORMAL(p, source);