key remap: simplify and use movable allocations

Have action.c control the key remap buflib allocation so that it can
be made movable. With memory management offloaded, core_keymap.c only
needs to deal with loading keymap files. Simplify the code there and
use buflib pinning so the file can be loaded directly into the buffer.

Change-Id: Ia654cc05ce6b286f96c1031fa4f7d4b3859a2c1a
This commit is contained in:
Aidan MacDonald 2022-04-03 13:48:52 +01:00
parent f47aa584a8
commit e4aec7d648
4 changed files with 131 additions and 165 deletions

View file

@ -34,13 +34,6 @@
/* Allocates core buffer, copies keymap to allow buttons for actions to be remapped*/
int core_set_keyremap(struct button_mapping* core_keymap, int count);
/* open_key_remap(filename , *fd (you must close file_descriptor), *fsize)
* checks/strips header and returns remaining count
* fd is opened and set to first record
* filesize contains the size of the remaining records
*/
int open_key_remap(const char *filename, int *fd, size_t *filesize);
/* load a remap file to allow buttons for actions to be remapped */
int core_load_key_remap(const char *filename);