summaryrefslogtreecommitdiff
path: root/debian/patches/ihash0002-libihash-rehash-if-effective-load-exceeds-the-thresh.patch
diff options
context:
space:
mode:
authorJustus Winter <justus@gnupg.org>2016-04-28 21:16:33 +0200
committerJustus Winter <justus@gnupg.org>2016-04-28 21:16:33 +0200
commit517e7ce899af98969103e273c8d9957dd3ec2be5 (patch)
tree7365657dfe4cec9a6ea9f4ee1ecd596233c73ff8 /debian/patches/ihash0002-libihash-rehash-if-effective-load-exceeds-the-thresh.patch
parent4a4eb912fe400f5609f72ac5b2301620fb51210a (diff)
add patch series
Diffstat (limited to 'debian/patches/ihash0002-libihash-rehash-if-effective-load-exceeds-the-thresh.patch')
-rw-r--r--debian/patches/ihash0002-libihash-rehash-if-effective-load-exceeds-the-thresh.patch47
1 files changed, 47 insertions, 0 deletions
diff --git a/debian/patches/ihash0002-libihash-rehash-if-effective-load-exceeds-the-thresh.patch b/debian/patches/ihash0002-libihash-rehash-if-effective-load-exceeds-the-thresh.patch
new file mode 100644
index 00000000..5d302020
--- /dev/null
+++ b/debian/patches/ihash0002-libihash-rehash-if-effective-load-exceeds-the-thresh.patch
@@ -0,0 +1,47 @@
+From 6d9f95487d0bd46e93e3390a7cc1bf88125def02 Mon Sep 17 00:00:00 2001
+From: Justus Winter <justus@gnupg.org>
+Date: Thu, 28 Apr 2016 21:12:58 +0200
+Subject: [PATCH hurd 2/2] libihash: rehash if effective load exceeds the
+ threshold
+
+* libihash/ihash.c (hurd_ihash_locp_add): Use the effective load.
+(hurd_ihash_add): Likewise. Use the load to decide whether we want to
+enlarge the table, otherwise we merely rehash.
+---
+ libihash/ihash.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/libihash/ihash.c b/libihash/ihash.c
+index 66175ca..7160055 100644
+--- a/libihash/ihash.c
++++ b/libihash/ihash.c
+@@ -291,7 +291,7 @@ hurd_ihash_locp_add (hurd_ihash_t ht, hurd_ihash_locp_t locp,
+ || item == NULL
+ || item->value == _HURD_IHASH_DELETED
+ || ! compare (ht, item->key, key)
+- || hurd_ihash_get_load (ht) > ht->max_load)
++ || hurd_ihash_get_effective_load (ht) > ht->max_load)
+ return hurd_ihash_add (ht, key, value);
+
+ if (item->value == _HURD_IHASH_EMPTY)
+@@ -332,7 +332,7 @@ hurd_ihash_add (hurd_ihash_t ht, hurd_ihash_key_t key, hurd_ihash_value_t item)
+ if (ht->size)
+ {
+ /* Only fill the hash table up to its maximum load factor. */
+- if (hurd_ihash_get_load (ht) <= ht->max_load)
++ if (hurd_ihash_get_effective_load (ht) <= ht->max_load)
+ add_one:
+ if (add_one (ht, key, item))
+ return 0;
+@@ -342,7 +342,7 @@ hurd_ihash_add (hurd_ihash_t ht, hurd_ihash_key_t key, hurd_ihash_value_t item)
+ ht->nr_items = 0;
+ if (ht->size == 0)
+ ht->size = HURD_IHASH_MIN_SIZE;
+- else
++ else if (hurd_ihash_get_load (ht) > ht->max_load)
+ ht->size <<= 1;
+ ht->nr_free = ht->size;
+
+--
+2.1.4
+