From: Sven Verdoolaege Date: Thu, 1 Aug 2013 11:22:16 +0000 (+0200) Subject: isl_ctx.c: find_nested_options: properly handle argument "groups" X-Git-Tag: isl-0.12.2~15 X-Git-Url: https://repo.or.cz/w/isl.git/commitdiff_plain/e57d7e7572823ac022c0409064839014d0c026f8 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 --- 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; }