keymap: call strlen on keymap string instead of SIZE_MAX

I wanted to avoid the strlen, but we'd better keep the scanner a bit
less surprising and encourage people to use xkb_keymap_new_from_buffer()
instead of they do in fact have access to the size.

Signed-off-by: Ran Benita <ran234@gmail.com>
master
Ran Benita 2013-10-09 12:12:59 +03:00
parent ca0d388f99
commit a45f531aa7
2 changed files with 3 additions and 2 deletions

View File

@ -218,7 +218,8 @@ xkb_keymap_new_from_string(struct xkb_context *ctx,
enum xkb_keymap_format format,
enum xkb_keymap_compile_flags flags)
{
return xkb_keymap_new_from_buffer(ctx, string, SIZE_MAX, format, flags);
return xkb_keymap_new_from_buffer(ctx, string, strlen(string),
format, flags);
}
XKB_EXPORT struct xkb_keymap *

View File

@ -80,7 +80,7 @@ peek(struct scanner *s)
static inline bool
eof(struct scanner *s)
{
return peek(s) == '\0';
return s->pos >= s->len;
}
static inline bool