From cfdd1d5124cb9a0e90f4de988601320ed401662a Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 13 Jan 2012 20:30:23 +0400 Subject: [PATCH] Add 'const' qualifier for GC_is_marked argument pointer * include/gc_mark.h (GC_is_marked): Refine comment. * include/gc_mark.h (GC_is_marked): Make passed pointer const. * mark.c (GC_is_marked): Likewise. * mark.c (GC_is_marked): Cast result to int (instead of GC_bool). --- include/gc_mark.h | 4 ++-- mark.c | 5 ++--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/include/gc_mark.h b/include/gc_mark.h index 17dbf71..e3141ce 100644 --- a/include/gc_mark.h +++ b/include/gc_mark.h @@ -220,8 +220,8 @@ GC_API void GC_CALL GC_set_start_callback(GC_start_callback_proc); GC_API GC_start_callback_proc GC_CALL GC_get_start_callback(void); /* Slow/general mark bit manipulation. The caller must hold the */ -/* allocation lock. */ -GC_API int GC_CALL GC_is_marked(void *); +/* allocation lock. GC_is_marked returns 1 (TRUE) or 0. */ +GC_API int GC_CALL GC_is_marked(const void *); GC_API void GC_CALL GC_clear_mark_bit(void *); GC_API void GC_CALL GC_set_mark_bit(void *); diff --git a/mark.c b/mark.c index 467c13e..b2a5d7c 100644 --- a/mark.c +++ b/mark.c @@ -224,16 +224,15 @@ GC_API void GC_CALL GC_clear_mark_bit(void *p) } } -GC_API int GC_CALL GC_is_marked(void *p) +GC_API int GC_CALL GC_is_marked(const void *p) { struct hblk *h = HBLKPTR(p); hdr * hhdr = HDR(h); word bit_no = MARK_BIT_NO((ptr_t)p - (ptr_t)h, hhdr -> hb_sz); - return((GC_bool)mark_bit_from_hdr(hhdr, bit_no)); + return (int)mark_bit_from_hdr(hhdr, bit_no); // 0 or 1 } - /* * Clear mark bits in all allocated heap blocks. This invalidates * the marker invariant, and sets GC_mark_state to reflect this. -- 2.7.4