1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-21 20:20:24 +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

@ -112,31 +112,40 @@ SCM_DEFINE (scm_print_options, "print-options-interface", 0, 1, 0,
* time complexity (O (depth * N)), The printer code can be * time complexity (O (depth * N)), The printer code can be
* 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); \ { \
if (pstate->top == pstate->ceiling) \ PSTATE_STACK_SET (pstate, pstate->top, obj); \
grow_ref_stack (pstate); \ pstate->top++; \
if (pstate->top == pstate->ceiling) \
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; \ { \
for (i = 0; i < pstate->top; ++i) \ register unsigned long i; \
if (scm_is_eq (PSTATE_STACK_REF (pstate, i), (obj))) \ for (i = 0; i < pstate->top; ++i) \
goto label; \ if (scm_is_eq (PSTATE_STACK_REF (pstate, i), (obj))) \
if (pstate->fancyp) \ goto label; \
{ \ if (pstate->fancyp) \
if (pstate->top - pstate->list_offset >= pstate->level) \ { \
{ \ if (pstate->top - pstate->list_offset >= pstate->level) \
scm_putc ('#', port); \ { \
return; \ scm_putc ('#', port); \
} \ return; \
} \ } \
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;