key-data.[ch] (key_copydata): New function copies filtered key data.