]> granicus.if.org Git - gc/commitdiff
Document assertion in the setters that used to return old value
authorIvan Maidanski <ivmai@mail.ru>
Tue, 6 Nov 2018 21:48:21 +0000 (00:48 +0300)
committerIvan Maidanski <ivmai@mail.ru>
Tue, 6 Nov 2018 21:48:21 +0000 (00:48 +0300)
(code refactoring)

* misc.c (GC_set_finalize_on_demand, GC_set_java_finalization,
GC_set_dont_expand, GC_set_no_dls, GC_set_max_retries,
GC_set_dont_precollect, GC_set_time_limit): Add comment about GC_ASSERT.

misc.c

diff --git a/misc.c b/misc.c
index f635348d3941f142928f021284c226a93dc62819..ced405bd383a31d5b49db190bfdc3822113507bc 100644 (file)
--- a/misc.c
+++ b/misc.c
@@ -2442,7 +2442,7 @@ GC_API int GC_CALL GC_get_all_interior_pointers(void)
 
 GC_API void GC_CALL GC_set_finalize_on_demand(int value)
 {
-    GC_ASSERT(value != -1);
+    GC_ASSERT(value != -1); /* -1 was used to retrieve old value in gc-7.2 */
     /* value is of boolean type. */
     GC_finalize_on_demand = value;
 }
@@ -2454,7 +2454,7 @@ GC_API int GC_CALL GC_get_finalize_on_demand(void)
 
 GC_API void GC_CALL GC_set_java_finalization(int value)
 {
-    GC_ASSERT(value != -1);
+    GC_ASSERT(value != -1); /* -1 was used to retrieve old value in gc-7.2 */
     /* value is of boolean type. */
     GC_java_finalization = value;
 }
@@ -2466,7 +2466,7 @@ GC_API int GC_CALL GC_get_java_finalization(void)
 
 GC_API void GC_CALL GC_set_dont_expand(int value)
 {
-    GC_ASSERT(value != -1);
+    GC_ASSERT(value != -1); /* -1 was used to retrieve old value in gc-7.2 */
     /* value is of boolean type. */
     GC_dont_expand = value;
 }
@@ -2478,7 +2478,7 @@ GC_API int GC_CALL GC_get_dont_expand(void)
 
 GC_API void GC_CALL GC_set_no_dls(int value)
 {
-    GC_ASSERT(value != -1);
+    GC_ASSERT(value != -1); /* -1 was used to retrieve old value in gc-7.2 */
     /* value is of boolean type. */
     GC_no_dls = value;
 }
@@ -2511,7 +2511,8 @@ GC_API GC_word GC_CALL GC_get_free_space_divisor(void)
 
 GC_API void GC_CALL GC_set_max_retries(GC_word value)
 {
-    GC_ASSERT(value != ~(word)0);
+    GC_ASSERT((GC_signed_word)value != -1);
+                        /* -1 was used to retrieve old value in gc-7.2 */
     GC_max_retries = value;
 }
 
@@ -2522,7 +2523,7 @@ GC_API GC_word GC_CALL GC_get_max_retries(void)
 
 GC_API void GC_CALL GC_set_dont_precollect(int value)
 {
-    GC_ASSERT(value != -1);
+    GC_ASSERT(value != -1); /* -1 was used to retrieve old value in gc-7.2 */
     /* value is of boolean type. */
     GC_dont_precollect = value;
 }
@@ -2545,7 +2546,8 @@ GC_API int GC_CALL GC_get_full_freq(void)
 
 GC_API void GC_CALL GC_set_time_limit(unsigned long value)
 {
-    GC_ASSERT(value != (unsigned long)-1L);
+    GC_ASSERT((long)value != -1L);
+                        /* -1 was used to retrieve old value in gc-7.2 */
     GC_time_limit = value;
 }