From b89b8e70237f401aa39b963313324f60396bdda8 Mon Sep 17 00:00:00 2001 From: Ran Benita Date: Sun, 13 May 2012 23:31:59 +0300 Subject: Change xkb_map_new_from_fd to use FILE* i.e. xkb_map_new_from_file. The reason is that flex only works with FILE's, so we must use fdopen on the file descriptor; but to avoid a memory leak, we must also fclose() it, which, in turn, closes the file descriptor itself. Either way is not acceptable, so we can either: * dup() the fd and use fdopen on that, or * have the user call fdopen on his own, and accept a FILE* instead of an fd. The second one seems better, and is standard C, so why not. We must add stdio.h to xkbcommon.h though, which is regrettable, but not a big deal. Signed-off-by: Ran Benita --- include/xkbcommon/xkbcommon.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'include') diff --git a/include/xkbcommon/xkbcommon.h b/include/xkbcommon/xkbcommon.h index 2b1eb96..e2786fe 100644 --- a/include/xkbcommon/xkbcommon.h +++ b/include/xkbcommon/xkbcommon.h @@ -82,6 +82,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include +#include #include #include @@ -260,11 +261,11 @@ enum xkb_keymap_format { /** * Creates an XKB keymap from a full text XKB keymap passed into the - * file descriptor. + * file. */ struct xkb_keymap * -xkb_map_new_from_fd(struct xkb_context *context, - int fd, enum xkb_keymap_format format, +xkb_map_new_from_file(struct xkb_context *context, + FILE *file, enum xkb_keymap_format format, enum xkb_map_compile_flags flags); /** -- cgit v1.2.1