keycodes: split CopyKeyInfoToKeymap to several functions

It's a bit easier to read and self-documenting. Also handles OOM better.

Signed-off-by: Ran Benita <ran234@gmail.com>
types: refactor CopyKeyTypesToKeymap

So it's OOM-safe and doesn't clobber keymap on failure.

Signed-off-by: Ran Benita <ran234@gmail.com>
ast-build: use cast instead of ->common

Missed in 1b2bb204e0baa2246a6232aea762c1edb00cd44a.

Signed-off-by: Ran Benita <ran234@gmail.com>
Replace darray_mem with a new darray_steal

That's a more declarative interface.

Signed-off-by: Ran Benita <ran234@gmail.com>