From: Daniel Roethlisberger Date: Sat, 11 Feb 2012 23:41:45 +0000 (+0100) Subject: Remove bogus kh_del() in example code X-Git-Tag: spawn-final~67^2^2 X-Git-Url: http://www.kaiwu.me/postgresql/commit/static/gitweb.js?a=commitdiff_plain;h=c3686a8557647af81f45e14746eaa8bce18621ef;p=klib.git Remove bogus kh_del() in example code The kh_del() causes the overwritten entry to be marked deleted and subsequently not found when using kh_get(). For integer typed hash tables, there is no need to check whether we are overwriting an existing entry or creating a new one. --- diff --git a/khash.h b/khash.h index a482fe1..1a28e11 100644 --- a/khash.h +++ b/khash.h @@ -33,7 +33,6 @@ int main() { khiter_t k; khash_t(32) *h = kh_init(32); k = kh_put(32, h, 5, &ret); - if (!ret) kh_del(32, h, k); kh_value(h, k) = 10; k = kh_get(32, h, 10); is_missing = (k == kh_end(h));