<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40711 >

A silly off-by-one bug in the hash iterator implementation.


-----------------------------------------------------------------------
数えることができないのかも。
commit b1c9260b3a2499911eb4d56b4e0af9437b856509
Author: Madeline Book <madeline.b...@gmail.com>
Date:   Sun Feb 8 17:19:39 2009 -0500

    Fix bug in hash iterator implementation.

diff --git a/utility/hash.c b/utility/hash.c
index a581b91..a405edf 100644
--- a/utility/hash.c
+++ b/utility/hash.c
@@ -870,7 +870,7 @@ struct iterator *hash_iter_init(struct hash_iter *it,
   it->vtable.get = hash_iter_get;
   it->vtable.valid = hash_iter_valid;
   it->b = h->buckets - 1;
-  it->end = h->buckets + h->num_buckets + 1;
+  it->end = h->buckets + h->num_buckets;
 
   /* Seek to the first used bucket. */
   hash_iter_next(ITERATOR(it));
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to