[PATCH libxkbcommon] keymap: add xkb_keymap_new_from_memory()
David Herrmann
dh.herrmann at gmail.com
Tue Mar 12 08:44:50 PDT 2013
Hi Bill
On Mon, Mar 11, 2013 at 7:06 PM, Bill Spitzak <spitzak at gmail.com> wrote:
> Okay looking more at your patch and the output of flex, I think you can just
> call yy_scan_bytes. It does a copy, true, but that is exactly what your code
> is doing. And it does it by reusing code that is already in the flex output.
yy_scan_bytes saves us a direct call to malloc(), nothing more. I
thought it's better to do that ourselves so we actually see that there
is a copy involved and not hide it in flex.
For instance if we ever add an mmap() interface or if we need it for
something else internally, we can reuse XkbParseBuffer() and don't
need another of these helpers. We could even remove XkbParseString()
and use XkbParseBuffer() instead.
Anyway, I'm open to change this to use yy_scan_bytes() instead if
that's preferred.
Regards
David
More information about the wayland-devel
mailing list