mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-10 05:50:26 +02:00
* gc.c (scm_protect_object): Avoid looking up the object handle
twice. (scm_unprotect_object): Abort if scm_unprotect_object is called on an unprotected object.
This commit is contained in:
parent
2dd6a83aed
commit
0f0f08998d
1 changed files with 14 additions and 13 deletions
|
@ -2145,11 +2145,7 @@ scm_protect_object (SCM obj)
|
|||
/* This critical section barrier will be replaced by a mutex. */
|
||||
SCM_REDEFER_INTS;
|
||||
|
||||
handle = scm_hashq_get_handle (scm_protects, obj);
|
||||
|
||||
if (SCM_IMP (handle))
|
||||
scm_hashq_create_handle_x (scm_protects, obj, SCM_MAKINUM (1));
|
||||
else
|
||||
handle = scm_hashq_create_handle_x (scm_protects, obj, SCM_MAKINUM (0));
|
||||
SCM_SETCDR (handle, SCM_MAKINUM (SCM_INUM (SCM_CDR (handle)) + 1));
|
||||
|
||||
SCM_REALLOW_INTS;
|
||||
|
@ -2172,7 +2168,12 @@ scm_unprotect_object (SCM obj)
|
|||
|
||||
handle = scm_hashq_get_handle (scm_protects, obj);
|
||||
|
||||
if (SCM_NIMP (handle))
|
||||
if (SCM_IMP (handle))
|
||||
{
|
||||
fprintf (stderr, "scm_unprotect_object called on unprotected object\n");
|
||||
abort ();
|
||||
}
|
||||
|
||||
{
|
||||
int count = SCM_INUM (SCM_CDR (handle)) - 1;
|
||||
if (count <= 0)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue