- p = mem_calloc (1, sizeof (struct keymap_t));
- p->len = len;
- p->keys = mem_malloc (len * sizeof (keycode_t));
- memcpy (p->keys, keys, len * sizeof (keycode_t));
- return (p);
+ p = p_new(struct keymap_t, 1);
+ p->len = len;
+ p->keys = p_dup(keys, len);
+ return p;