Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/cdb Redo hashing, if two of the three individual ha...



details:   https://anonhg.NetBSD.org/src/rev/b7d3560e9b9c
branches:  trunk
changeset: 780368:b7d3560e9b9c
user:      joerg <joerg%NetBSD.org@localhost>
date:      Sat Jul 21 22:49:37 2012 +0000

description:
Redo hashing, if two of the three individual hashes result in identical
hash modules. This is the trivial case for loops in the 3-graph and got
lost when adopting the nbperf code.

diffstat:

 lib/libc/cdb/cdbw.c |  11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diffs (32 lines):

diff -r 19e24cce5ef5 -r b7d3560e9b9c lib/libc/cdb/cdbw.c
--- a/lib/libc/cdb/cdbw.c       Sat Jul 21 22:22:55 2012 +0000
+++ b/lib/libc/cdb/cdbw.c       Sat Jul 21 22:49:37 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: cdbw.c,v 1.4 2012/06/03 21:02:50 joerg Exp $   */
+/*     $NetBSD: cdbw.c,v 1.5 2012/07/21 22:49:37 joerg Exp $   */
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -36,7 +36,7 @@
 #endif
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: cdbw.c,v 1.4 2012/06/03 21:02:50 joerg Exp $");
+__RCSID("$NetBSD: cdbw.c,v 1.5 2012/07/21 22:49:37 joerg Exp $");
 
 #include "namespace.h"
 
@@ -387,6 +387,13 @@
                        e->middle = hashes[1] % state->entries;
                        e->right = hashes[2] % state->entries;
 
+                       if (e->left == e->middle)
+                               return -1;
+                       if (e->left == e->right)
+                               return -1;
+                       if (e->middle == e->right)
+                               return -1;
+
                        ++e;
                }
        }



Home | Main Index | Thread Index | Old Index