From 55d28e938eb78093f16a0ce1f1fa98ebc95112e8 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Thu, 29 Sep 2005 19:15:54 +0000 Subject: [PATCH] In HASH-TABLE/COUNT, rehash the table if it needs it -- this is the only way to guarantee an accurate count. --- v7/src/runtime/hashtb.scm | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/v7/src/runtime/hashtb.scm b/v7/src/runtime/hashtb.scm index 25ce6e060..2924b9e20 100644 --- a/v7/src/runtime/hashtb.scm +++ b/v7/src/runtime/hashtb.scm @@ -1,6 +1,6 @@ #| -*-Scheme-*- -$Id: hashtb.scm,v 1.32 2005/01/23 17:53:05 cph Exp $ +$Id: hashtb.scm,v 1.33 2005/09/29 19:15:54 cph Exp $ Copyright 1990,1991,1993,1994,1995,2003 Massachusetts Institute of Technology Copyright 2004,2005 Massachusetts Institute of Technology @@ -225,7 +225,13 @@ USA. (define (hash-table/count table) (guarantee-hash-table table 'HASH-TABLE/COUNT) - (table-count table)) + (let loop () + (let ((count (table-count table))) + (if (table-needs-rehash? table) + (begin + (rehash-table! table) + (loop)) + count)))) (define (hash-table/size table) (guarantee-hash-table table 'HASH-TABLE/SIZE) -- 2.25.1