1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-23 04:50:28 +02:00

* print.c (EXIT_NESTED_DATA): Before popping from the stack, reset

the value at its top.  This fixes a reference leak.
	(PUSH_REF): Perform `pstate->top++' after calling
	`PSTATE_STACK_SET ()' in order to avoid undesired potential side
	effects.
This commit is contained in:
Neil Jerram 2005-11-17 18:50:01 +00:00
parent 3f98874a96
commit dbb5de2949
2 changed files with 38 additions and 21 deletions

View file

@ -1,3 +1,11 @@
2005-11-17 Ludovic Courtès <ludovic.courtes@laas.fr>
* print.c (EXIT_NESTED_DATA): Before popping from the stack, reset
the value at its top. This fixes a reference leak.
(PUSH_REF): Perform `pstate->top++' after calling
`PSTATE_STACK_SET ()' in order to avoid undesired potential side
effects.
2005-11-12 Ludovic Courtès <ludovic.courtes@laas.fr> 2005-11-12 Ludovic Courtès <ludovic.courtes@laas.fr>
* gc.c (scm_weak_vectors): Removed. * gc.c (scm_weak_vectors): Removed.

View file

@ -113,14 +113,17 @@ SCM_DEFINE (scm_print_options, "print-options-interface", 0, 1, 0,
* rewritten to be O(N). * rewritten to be O(N).
*/ */
#define PUSH_REF(pstate, obj) \ #define PUSH_REF(pstate, obj) \
do { \ do \
PSTATE_STACK_SET (pstate, pstate->top++, obj); \ { \
PSTATE_STACK_SET (pstate, pstate->top, obj); \
pstate->top++; \
if (pstate->top == pstate->ceiling) \ if (pstate->top == pstate->ceiling) \
grow_ref_stack (pstate); \ grow_ref_stack (pstate); \
} while(0) } while(0)
#define ENTER_NESTED_DATA(pstate, obj, label) \ #define ENTER_NESTED_DATA(pstate, obj, label) \
do { \ do \
{ \
register unsigned long i; \ register unsigned long i; \
for (i = 0; i < pstate->top; ++i) \ for (i = 0; i < pstate->top; ++i) \
if (scm_is_eq (PSTATE_STACK_REF (pstate, i), (obj))) \ if (scm_is_eq (PSTATE_STACK_REF (pstate, i), (obj))) \
@ -136,7 +139,13 @@ do { \
PUSH_REF(pstate, obj); \ PUSH_REF(pstate, obj); \
} while(0) } while(0)
#define EXIT_NESTED_DATA(pstate) { --pstate->top; } #define EXIT_NESTED_DATA(pstate) \
do \
{ \
--pstate->top; \
PSTATE_STACK_SET (pstate, pstate->top, SCM_UNDEFINED); \
} \
while (0)
SCM scm_print_state_vtable = SCM_BOOL_F; SCM scm_print_state_vtable = SCM_BOOL_F;
static SCM print_state_pool = SCM_EOL; static SCM print_state_pool = SCM_EOL;