1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-30 20:00:19 +02:00

Reinstate `scm_protects', for backward compatibility.

Partly reverts e7efe8e793 ("decruftify
scm_sys_protects").

* libguile/gc.c (protects): Rename to...
  (scm_protects): ... this.

* libguile/gc.h (scm_protects): Add declaration.
This commit is contained in:
Ludovic Courtès 2010-02-13 19:33:51 +01:00
parent 524aa8ae68
commit acbccb0c83
2 changed files with 11 additions and 7 deletions

View file

@ -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