From e57d7e7572823ac022c0409064839014d0c026f8 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 1 Aug 2013 13:22:16 +0200 Subject: [PATCH] isl_ctx.c: find_nested_options: properly handle argument "groups" An argument group is encoded as a child with an offset of -1 and we are obviously not allowed to use this -1 as an offset. Instead, the structure holding the child options is the same as that of the parent. Signed-off-by: Sven Verdoolaege --- isl_ctx.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/isl_ctx.c b/isl_ctx.c index 7720be47..5e8e38a4 100644 --- a/isl_ctx.c +++ b/isl_ctx.c @@ -45,11 +45,19 @@ static struct isl_options *find_nested_options(struct isl_args *args, return opt; for (i = 0; args->args[i].type != isl_arg_end; ++i) { - if (args->args[i].type != isl_arg_child) + struct isl_arg *arg = &args->args[i]; + void *child; + + if (arg->type != isl_arg_child) continue; - options = find_nested_options(args->args[i].u.child.child, - *(void **)(((char *)opt) + args->args[i].offset), - wanted); + + if (arg->offset == (size_t) -1) + child = opt; + else + child = *(void **)(((char *)opt) + arg->offset); + + options = find_nested_options(arg->u.child.child, + child, wanted); if (options) return options; } -- 2.11.4.GIT