Permalink
Browse files

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.
  • Loading branch information...
1 parent e8bf8d5 commit c3686a8557647af81f45e14746eaa8bce18621ef @droe droe committed Feb 11, 2012
Showing with 0 additions and 1 deletion.
  1. +0 −1 khash.h
View
@@ -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));

0 comments on commit c3686a8

Please sign in to comment.