From 58e55d40a1a0220c511feaea9217cffe38dcdccb Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Sat, 23 Mar 2024 23:50:30 +0300 Subject: [PATCH] Use GC_HIDE_POINTER() in small_cons_uncollectable() of gctest (refactoring) Issue #627 (bdwgc). * tests/gctest.c (small_cons_uncollectable): Use GC_HIDE_POINTER(). * tests/gctest.c (UNCOLLECTABLE_CDR): Use GC_REVEAL_POINTER(). --- tests/gctest.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/gctest.c b/tests/gctest.c index 634854bb4..cd8cf879e 100644 --- a/tests/gctest.c +++ b/tests/gctest.c @@ -426,8 +426,8 @@ static sexpr small_cons_uncollectable(sexpr x, sexpr y) sexpr r = (sexpr)checkOOM(GC_MALLOC_UNCOLLECTABLE(sizeof(struct SEXPR))); AO_fetch_and_add1(&uncollectable_count); - r -> sexpr_cdr = (sexpr)(~(GC_word)y); - GC_PTR_STORE_AND_DIRTY(&r->sexpr_car, x); + r -> sexpr_cdr = (sexpr)GC_HIDE_POINTER(y); + GC_PTR_STORE_AND_DIRTY(&(r -> sexpr_car), x); return r; } @@ -579,7 +579,7 @@ static void check_ints(sexpr list, int low, int up) } } -# define UNCOLLECTABLE_CDR(x) (sexpr)(~(GC_word)cdr(x)) +#define UNCOLLECTABLE_CDR(x) (sexpr)GC_REVEAL_POINTER(cdr(x)) static void check_uncollectable_ints(sexpr list, int low, int up) {