From: NeilBrown Date: Fri, 8 Sep 2023 10:32:52 +0000 (+1000) Subject: keymap: switch to embedded-data pattern. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;h=0a5ec9e5520561f881d4ab89d2b77d5d9a3715eb;p=edlib.git keymap: switch to embedded-data pattern. Signed-off-by: NeilBrown --- diff --git a/lib-keymap.c b/lib-keymap.c index 39471644..16e38f10 100644 --- a/lib-keymap.c +++ b/lib-keymap.c @@ -11,11 +11,13 @@ #include #include +#define PANE_DATA_TYPE struct key_data #include "core.h" struct key_data { struct command *globalcmd; }; +#include "core-pane.h" static struct pane *safe do_keymap_attach(struct pane *p safe); @@ -27,11 +29,6 @@ DEF_CMD(keymap_handle) command_put(kd->globalcmd); return 1; } - if (strcmp(ci->key, "Free") == 0) { - free(kd); - ci->home->data = safe_cast NULL; - return 1; - } if (strcmp(ci->key, "Clone") == 0) { struct pane *p = do_keymap_attach(ci->focus); struct key_data *kd_old = ci->home->data; @@ -67,10 +64,7 @@ DEF_CMD(keymap_handle) static struct pane *safe do_keymap_attach(struct pane *p safe) { - struct key_data *kd = malloc(sizeof(*kd)); - - kd->globalcmd = NULL; - return pane_register(p, 0, &keymap_handle, kd); + return pane_register(p, 0, &keymap_handle); } DEF_CMD(keymap_attach)