1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 21:10:27 +02:00

(scm_finish_srcprop): use

scm_gc_register_collectable_memory()
(scm_make_srcprops): idem.
This commit is contained in:
Han-Wen Nienhuys 2003-05-15 22:48:20 +00:00
parent 131805f0cd
commit 0068984be5
2 changed files with 11 additions and 3 deletions

View file

@ -1,3 +1,9 @@
2003-05-16 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* srcprop.c (scm_finish_srcprop): use
scm_gc_register_collectable_memory()
(scm_make_srcprops): idem.
2003-05-14 Han-Wen Nienhuys <hanwen@cs.uu.nl> 2003-05-14 Han-Wen Nienhuys <hanwen@cs.uu.nl>
* gc-malloc.c (scm_gc_register_collectable_memory): avoid * gc-malloc.c (scm_gc_register_collectable_memory): avoid

View file

@ -114,7 +114,8 @@ scm_make_srcprops (long line, int col, SCM filename, SCM copy, SCM plist)
SCM_SYSCALL (mem = (scm_t_srcprops_chunk *) scm_malloc (n)); SCM_SYSCALL (mem = (scm_t_srcprops_chunk *) scm_malloc (n));
if (mem == NULL) if (mem == NULL)
scm_memory_error ("srcprops"); scm_memory_error ("srcprops");
scm_mallocated += n; scm_gc_register_collectable_memory (mem, n, "srcprops");
mem->next = srcprops_chunklist; mem->next = srcprops_chunklist;
srcprops_chunklist = mem; srcprops_chunklist = mem;
ptr = &mem->srcprops[0]; ptr = &mem->srcprops[0];
@ -319,12 +320,13 @@ void
scm_finish_srcprop () scm_finish_srcprop ()
{ {
register scm_t_srcprops_chunk *ptr = srcprops_chunklist, *next; register scm_t_srcprops_chunk *ptr = srcprops_chunklist, *next;
size_t n= sizeof (scm_t_srcprops_chunk)
+ sizeof (scm_t_srcprops) * (SRCPROPS_CHUNKSIZE - 1);
while (ptr) while (ptr)
{ {
next = ptr->next; next = ptr->next;
scm_gc_unregister_collectable_memory (ptr, n, "srcprops");
free ((char *) ptr); free ((char *) ptr);
scm_mallocated -= sizeof (scm_t_srcprops_chunk)
+ sizeof (scm_t_srcprops) * (SRCPROPS_CHUNKSIZE - 1);
ptr = next; ptr = next;
} }
} }