diff --git a/src/gc.h b/src/gc.h index bf7356c743dccb83b0d70a5ac214cd3a7a799113..d58facf35a26fc3d106063127d9de417536ce533 100644 --- a/src/gc.h +++ b/src/gc.h @@ -1,5 +1,5 @@ /* - * $Id: gc.h,v 1.66 2000/09/15 00:30:55 mast Exp $ + * $Id: gc.h,v 1.67 2000/09/15 00:59:39 mast Exp $ */ #ifndef GC_H #define GC_H @@ -50,13 +50,29 @@ extern void *gc_svalue_location; #endif #ifdef PIKE_DEBUG + +/* Use this when freeing blocks that you've used any gc_check or + * gc_mark function on and that can't contain references. */ +#define GC_FREE_SIMPLE_BLOCK(PTR) do { \ + extern int d_flag; \ + if(d_flag) CHECK_INTERPRETER_LOCK(); \ + if (Pike_in_gc == GC_PASS_CHECK) \ + fatal("No free is allowed in this gc pass.\n"); \ + else \ + remove_marker(PTR); \ +} while (0) + +/* Use this when freeing blocks that you've used any gc_check or + * gc_mark function on and that can contain references. */ #define GC_FREE_BLOCK(PTR) do { \ extern int d_flag; \ if(d_flag) CHECK_INTERPRETER_LOCK(); \ if (Pike_in_gc > GC_PASS_PREPARE && Pike_in_gc < GC_PASS_FREE) \ fatal("Freeing objects within gc is not allowed.\n"); \ } while (0) + #else +#define GC_FREE_SIMPLE_BLOCK(PTR) do {} while (0) #define GC_FREE_BLOCK(PTR) do {} while (0) #endif diff --git a/src/stralloc.c b/src/stralloc.c index e41e056c082201572e6e200f3b3c4825518ae245..c03d208d010ac29656d0f444c33d673cdf70bd08 100644 --- a/src/stralloc.c +++ b/src/stralloc.c @@ -25,7 +25,7 @@ #define HUGE HUGE_VAL #endif /*!HUGE*/ -RCSID("$Id: stralloc.c,v 1.100 2000/09/14 19:58:44 mast Exp $"); +RCSID("$Id: stralloc.c,v 1.101 2000/09/15 00:59:39 mast Exp $"); #define BEGIN_HASH_SIZE 997 #define MAX_AVG_LINK_LENGTH 3 @@ -742,7 +742,7 @@ PMOD_EXPORT void really_free_string(struct pike_string *s) #endif unlink_pike_string(s); debug_free((char *)s,DMALLOC_LOCATION(),1); - GC_FREE_BLOCK(s); + GC_FREE_SIMPLE_BLOCK(s); } PMOD_EXPORT void debug_free_string(struct pike_string *s)