summaryrefslogtreecommitdiff
path: root/libguile/gc.c
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2010-02-13 19:33:51 +0100
committerLudovic Courtès <ludo@gnu.org>2010-02-13 19:33:51 +0100
commitacbccb0c834e3d28d14c60c98c730969edcdfbcc (patch)
tree073a169cda1042d9ce25f7bbcf69a1dfb4ad38f0 /libguile/gc.c
parent524aa8ae6830d0f471f0c86431d5da87c8a0a534 (diff)
downloadguile-acbccb0c834e3d28d14c60c98c730969edcdfbcc.tar.gz
Reinstate `scm_protects', for backward compatibility.
Partly reverts e7efe8e793fa51ea898aea4477939c598b3e9fac ("decruftify scm_sys_protects"). * libguile/gc.c (protects): Rename to... (scm_protects): ... this. * libguile/gc.h (scm_protects): Add declaration.
Diffstat (limited to 'libguile/gc.c')
-rw-r--r--libguile/gc.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/libguile/gc.c b/libguile/gc.c
index 700f3a41c..fc405f307 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -89,7 +89,10 @@ int scm_debug_cells_gc_interval = 0;
*/
int scm_i_cell_validation_already_running ;
-static SCM protects;
+/* Hash table that keeps a reference to objects the user wants to protect from
+ garbage collection. It could arguably be private but applications have come
+ to rely on it (e.g., Lilypond 2.13.9). */
+SCM scm_protects;
#if (SCM_DEBUG_CELL_ACCESSES == 1)
@@ -507,7 +510,7 @@ scm_gc_protect_object (SCM obj)
critsec/mutex inconsistency here. */
SCM_CRITICAL_SECTION_START;
- handle = scm_hashq_create_handle_x (protects, obj, scm_from_int (0));
+ handle = scm_hashq_create_handle_x (scm_protects, obj, scm_from_int (0));
SCM_SETCDR (handle, scm_sum (SCM_CDR (handle), scm_from_int (1)));
protected_obj_count ++;
@@ -537,7 +540,7 @@ scm_gc_unprotect_object (SCM obj)
abort ();
}
- handle = scm_hashq_get_handle (protects, obj);
+ handle = scm_hashq_get_handle (scm_protects, obj);
if (scm_is_false (handle))
{
@@ -548,7 +551,7 @@ scm_gc_unprotect_object (SCM obj)
{
SCM count = scm_difference (SCM_CDR (handle), scm_from_int (1));
if (scm_is_eq (count, scm_from_int (0)))
- scm_hashq_remove_x (protects, obj);
+ scm_hashq_remove_x (scm_protects, obj);
else
SCM_SETCDR (handle, count);
}
@@ -636,7 +639,7 @@ scm_storage_prehistory ()
/* GC_REGISTER_DISPLACEMENT (scm_tc3_unused); */
/* Sanity check. */
- if (!GC_is_visible (&protects))
+ if (!GC_is_visible (&scm_protects))
abort ();
scm_c_hook_init (&scm_before_gc_c_hook, 0, SCM_C_HOOK_NORMAL);
@@ -651,7 +654,7 @@ scm_i_pthread_mutex_t scm_i_gc_admin_mutex = SCM_I_PTHREAD_MUTEX_INITIALIZER;
void
scm_init_gc_protect_object ()
{
- protects = scm_c_make_hash_table (31);
+ scm_protects = scm_c_make_hash_table (31);
#if 0
/* We can't have a cleanup handler since we have no thread to run it