--- rxvt-unicode/src/keyboard.C 2010/08/24 23:57:04 1.37 +++ rxvt-unicode/src/keyboard.C 2011/01/05 17:00:17 1.38 @@ -252,10 +252,8 @@ unsigned int i, index, hashkey; vector sorted_keymap; uint16_t hash_bucket_size[KEYSYM_HASH_BUCKETS]; // size of each bucket - uint16_t hash_bucket_counter[KEYSYM_HASH_BUCKETS]; // #elements in each bucket memset (hash_bucket_size, 0, sizeof (hash_bucket_size)); - memset (hash_bucket_counter, 0, sizeof (hash_bucket_counter)); // determine hash bucket size for (i = 0; i < keymap.size (); ++i) @@ -277,6 +275,8 @@ // and allocate just enough space sorted_keymap.insert (sorted_keymap.begin (), index + hash_bucket_size [i - 1], 0); + memset (hash_bucket_size, 0, sizeof (hash_bucket_size)); + // fill in sorted_keymap // it is sorted in each bucket for (i = 0; i < keymap.size (); ++i) @@ -284,7 +284,7 @@ { hashkey = (keymap [i]->keysym + j) & KEYSYM_HASH_MASK; - index = hash [hashkey] + hash_bucket_counter [hashkey]; + index = hash [hashkey] + hash_bucket_size [hashkey]; while (index > hash [hashkey] && compare_priority (keymap [i], sorted_keymap [index - 1]) > 0) @@ -294,7 +294,7 @@ } sorted_keymap [index] = keymap [i]; - ++hash_bucket_counter [hashkey]; + ++hash_bucket_size [hashkey]; } keymap.swap (sorted_keymap);