The keysym cache for the new scanner was not initialized.
To avoid such errors also in the future, require passing the priv
argument in scanner_init(), instead of initializing it separately.
Signed-off-by: Ran Benita <ran234@gmail.com>
goto err_file;
}
- scanner_init(&new_s, table->ctx, string, size, path);
+ scanner_init(&new_s, table->ctx, string, size, path, s->priv);
ok = parse(table, &new_s, include_depth + 1);
if (!ok)
{
struct scanner s;
struct keysym_from_name_cache cache;
- scanner_init(&s, table->ctx, string, len, file_name);
memset(&cache, 0, sizeof(cache));
- s.priv = &cache;
+ scanner_init(&s, table->ctx, string, len, file_name, &cache);
if (!parse(table, &s, 0))
return false;
/* Maybe the allocator can use the excess space. */
static inline void
scanner_init(struct scanner *s, struct xkb_context *ctx,
- const char *string, size_t len, const char *file_name)
+ const char *string, size_t len, const char *file_name,
+ void *priv)
{
s->s = string;
s->len = len;
s->token_line = s->token_column = 1;
s->file_name = file_name;
s->ctx = ctx;
+ s->priv = priv;
}
static inline char
if (!m)
return false;
- scanner_init(&m->scanner, m->ctx, string, len, file_name);
+ scanner_init(&m->scanner, m->ctx, string, len, file_name, NULL);
initial:
switch (tok = gettok(m)) {
const char *file_name, const char *map)
{
struct scanner scanner;
- scanner_init(&scanner, ctx, string, len, file_name);
+ scanner_init(&scanner, ctx, string, len, file_name, NULL);
return parse(ctx, &scanner, map);
}