diff options
author | Ran Benita <ran234@gmail.com> | 2012-05-13 23:31:59 +0300 |
---|---|---|
committer | name <email> | 2012-05-18 20:54:33 +0300 |
commit | b89b8e70237f401aa39b963313324f60396bdda8 (patch) | |
tree | de17ae419d5647db0ea08202a1b4503cb49dde8d /include | |
parent | d15fa57a4b1402a6a419ed34f0fc309f0a26df4f (diff) | |
download | xorg-lib-libxkbcommon-b89b8e70237f401aa39b963313324f60396bdda8.tar.gz |
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 <ran234@gmail.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/xkbcommon/xkbcommon.h | 7 |
1 files changed, 4 insertions, 3 deletions
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 <stddef.h> #include <stdint.h> +#include <stdio.h> #include <xkbcommon/xkbcommon-names.h> #include <xkbcommon/xkbcommon-keysyms.h> @@ -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); /** |