]> granicus.if.org Git - gc/commitdiff
Add assertion to GC_incremental_protection_needs, refine documentation
authorIvan Maidanski <ivmai@mail.ru>
Wed, 1 Feb 2012 17:12:07 +0000 (21:12 +0400)
committerIvan Maidanski <ivmai@mail.ru>
Wed, 1 Feb 2012 17:12:07 +0000 (21:12 +0400)
* include/gc.h (GC_incremental_protection_needs): Improve comment.
* os_dep.c (GC_incremental_protection_needs): Add assertion on GC is
initialized.

include/gc.h
os_dep.c

index c76e1ba44aa06a3db594e8c6850e4630fbeba37f..212d175cb7f4424abe32dbbc03e94d956a06bbfb 100644 (file)
@@ -613,6 +613,7 @@ GC_API void GC_CALL GC_enable_incremental(void);
 #define GC_PROTECTS_STACK         8 /* Probably impractical.            */
 
 #define GC_PROTECTS_NONE 0
+/* The collector is assumed to be initialized before this call.         */
 GC_API int GC_CALL GC_incremental_protection_needs(void);
 
 /* Perform some garbage collection work, if appropriate.        */
index 7cdd3bb5c5ee944746bdc573d55d912ac260fb60..c4058416d5cdf64199e8294071fe2d5d8386bbfe 100644 (file)
--- a/os_dep.c
+++ b/os_dep.c
@@ -3364,6 +3364,8 @@ GC_INNER void GC_remove_protection(struct hblk *h, word nblocks,
 
 GC_API int GC_CALL GC_incremental_protection_needs(void)
 {
+    GC_ASSERT(GC_is_initialized);
+
     if (GC_page_size == HBLKSIZE) {
         return GC_PROTECTS_POINTER_HEAP;
     } else {