summaryrefslogtreecommitdiff
path: root/mark.c
diff options
context:
space:
mode:
authorIvan Maidanski <ivmai@mail.ru>2016-03-09 23:12:25 +0300
committerIvan Maidanski <ivmai@mail.ru>2016-03-09 23:12:25 +0300
commit965c9f9865a1f2e7447294d3a4f7d1e23c097691 (patch)
tree1b77a71c3267c991a18c875cecee92682b655370 /mark.c
parent9ddff68a20c064288da73a4316cabaef661948ab (diff)
downloadbdwgc-965c9f9865a1f2e7447294d3a4f7d1e23c097691.tar.gz
Refactoring of mark_and_push_stack (check GC_base result for null)
* mark.c (GC_mark_and_push_stack): Check GC_base() result (do not pass NULL to HDR()).
Diffstat (limited to 'mark.c')
-rw-r--r--mark.c15
1 files changed, 6 insertions, 9 deletions
diff --git a/mark.c b/mark.c
index de57bec1..37de535d 100644
--- 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);