[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-142-g63d86
From: |
Mark H Weaver |
Subject: |
[Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-142-g63d869e |
Date: |
Sun, 12 Jan 2014 12:43:28 +0000 |
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Guile".
http://git.savannah.gnu.org/cgit/guile.git/commit/?id=63d869e74c183faf8e73c73908ef912fdb20198e
The branch, stable-2.0 has been updated
via 63d869e74c183faf8e73c73908ef912fdb20198e (commit)
from f974224d97bce334b6dcf20ecd8ffa84d270e0cd (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 63d869e74c183faf8e73c73908ef912fdb20198e
Author: Mark H Weaver <address@hidden>
Date: Sun Jan 12 07:11:44 2014 -0500
Fix hashing of empty vectors.
Fixes a bug introduced in cc1cd04f8111c306cf48b93e131d5c1765c808a3
"Fix hashing of vectors to run in bounded time."
* libguile/hash.c (scm_hasher): Avoid division by zero.
* test-suite/tests/hash.test ("hash"): Add tests.
-----------------------------------------------------------------------
Summary of changes:
libguile/hash.c | 2 +-
test-suite/tests/hash.test | 15 +++++++++++++--
2 files changed, 14 insertions(+), 3 deletions(-)
diff --git a/libguile/hash.c b/libguile/hash.c
index c0a6109..3429310 100644
--- a/libguile/hash.c
+++ b/libguile/hash.c
@@ -245,7 +245,7 @@ scm_hasher(SCM obj, unsigned long n, size_t d)
{
i = len;
h = n - 1;
- d2 = (d - 1) / len;
+ d2 = len > 0 ? (d - 1) / len : 0;
}
while (i--)
diff --git a/test-suite/tests/hash.test b/test-suite/tests/hash.test
index ad247f5..64d10bb 100644
--- a/test-suite/tests/hash.test
+++ b/test-suite/tests/hash.test
@@ -1,6 +1,7 @@
;;;; hash.test --- test guile hashing -*- scheme -*-
;;;;
-;;;; Copyright (C) 2004, 2005, 2006, 2008, 2011, 2012 Free Software
Foundation, Inc.
+;;;; Copyright (C) 2004, 2005, 2006, 2008, 2011, 2012,
+;;;; 2014 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
@@ -36,7 +37,17 @@
(pass-if (= 0 (hash noop 1)))
(pass-if (= 0 (hash +inf.0 1)))
(pass-if (= 0 (hash -inf.0 1)))
- (pass-if (= 0 (hash +nan.0 1))))
+ (pass-if (= 0 (hash +nan.0 1)))
+ (pass-if (= 0 (hash '#() 1)))
+
+ (pass-if "cyclic vectors"
+ (let ()
+ (define (cyclic-vector n)
+ (let ((v (make-vector n)))
+ (vector-fill! v v)
+ v))
+ (and (= 0 (hash (cyclic-vector 3) 1))
+ (= 0 (hash (cyclic-vector 10) 1))))))
;;;
;;; hashv
hooks/post-receive
--
GNU Guile
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Guile-commits] GNU Guile branch, stable-2.0, updated. v2.0.9-142-g63d869e,
Mark H Weaver <=