the only difference between
g_hash_table_insert and g_hash_table_replace is which key gets
freed/used
insert reuses the old key while replace used the new key
both insert the value or replace the value if it already exists
since the key is in the structure we allocate, we always
want to use the new key, and the old structure to be freed
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
e->keycode = keycode;
e->hkey = mask << 8 | (keycode & 255);
- g_hash_table_insert(keymap, &e->hkey, e);
+ g_hash_table_replace(keymap, &e->hkey, e);
}