diff options
author | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2003-04-05 20:45:17 +0000 |
---|---|---|
committer | Mikael Djurfeldt <djurfeldt@nada.kth.se> | 2003-04-05 20:45:17 +0000 |
commit | 15635be59e37b7a26bdfa1a2376c27952a4833da (patch) | |
tree | fc4c39a305b930ca879742b8f20384784de9700c | |
parent | 73be1d9e8ef3744723949752311e60d6a0f89342 (diff) | |
download | guile-15635be59e37b7a26bdfa1a2376c27952a4833da.tar.gz |
* hashtab.c (rehash_after_gc): Clear to_rehash list before
processing it in order to avoid an infinite loop.
* print.c (scm_prin1): Remember old state of pstate->writingp.
-rw-r--r-- | libguile/ChangeLog | 8 | ||||
-rw-r--r-- | libguile/hashtab.c | 4 | ||||
-rw-r--r-- | libguile/print.c | 5 |
3 files changed, 15 insertions, 2 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 1a5a15f8e..8cab3bcd9 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,10 @@ +2003-04-05 Mikael Djurfeldt <djurfeldt@nada.kth.se> + + * hashtab.c (rehash_after_gc): Clear to_rehash list before + processing it in order to avoid an infinite loop. + + * print.c (scm_prin1): Remember old state of pstate->writingp. + 2003-04-05 Marius Vollmer <mvo@zagadka.de> * Changed license terms to the plain LGPL thru-out. @@ -317,6 +324,7 @@ (scmconfig.h): build scmconfig.h from gen-scmconfig's output. (BUILT_SOURCES): add scmconfig.h. +>>>>>>> 1.1798 2003-03-19 Marius Vollmer <mvo@zagadka.de> * gc_os_dep.c: Added defines for sparc-unknown-netbsdelf1.5 from diff --git a/libguile/hashtab.c b/libguile/hashtab.c index 153f241ab..f6cc26311 100644 --- a/libguile/hashtab.c +++ b/libguile/hashtab.c @@ -269,6 +269,9 @@ rehash_after_gc (void *dummy1 SCM_UNUSED, if (!SCM_NULLP (to_rehash)) { SCM h = to_rehash, last; + /* important to clear to_rehash here so that we don't get stuck + in an infinite loop if scm_i_rehash causes GC */ + to_rehash = SCM_EOL; do { scm_i_rehash (h, @@ -282,7 +285,6 @@ rehash_after_gc (void *dummy1 SCM_UNUSED, /* move tables back to weak_hashtables */ SCM_SET_HASHTABLE_NEXT (last, weak_hashtables); weak_hashtables = to_rehash; - to_rehash = SCM_EOL; } return 0; } diff --git a/libguile/print.c b/libguile/print.c index 997fecaf9..f0b8ec1d0 100644 --- a/libguile/print.c +++ b/libguile/print.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1995-1999,2000,2001, 2002 Free Software Foundation, Inc. +/* Copyright (C) 1995-1999,2000,2001, 2002, 2003 Free Software Foundation, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -657,6 +657,7 @@ scm_prin1 (SCM exp, SCM port, int writingp) SCM handle = SCM_BOOL_F; /* Will GC protect the handle whilst unlinked */ SCM pstate_scm; scm_print_state *pstate; + int old_writingp; /* If PORT is a print-state/port pair, use that. Else create a new print-state. */ @@ -682,8 +683,10 @@ scm_prin1 (SCM exp, SCM port, int writingp) } pstate = SCM_PRINT_STATE (pstate_scm); + old_writingp = pstate->writingp; pstate->writingp = writingp; scm_iprin1 (exp, port, pstate); + pstate->writingp = old_writingp; /* Return print state to pool if it has been created above and hasn't escaped to Scheme. */ |