* Add an option instance to currently parsed group. */
| 691 | * Add an option instance to currently parsed group. |
| 692 | */ |
| 693 | static void add_opt(OptionParseContext *octx, const OptionDef *opt, |
| 694 | const char *key, const char *val) |
| 695 | { |
| 696 | int global = !(opt->flags & (OPT_PERFILE | OPT_SPEC | OPT_OFFSET)); |
| 697 | OptionGroup *g = global ? &octx->global_opts : &octx->cur_group; |
| 698 | |
| 699 | GROW_ARRAY(g->opts, g->nb_opts); |
| 700 | g->opts[g->nb_opts - 1].opt = opt; |
| 701 | g->opts[g->nb_opts - 1].key = key; |
| 702 | g->opts[g->nb_opts - 1].val = val; |
| 703 | } |
| 704 | |
| 705 | static void init_parse_context(OptionParseContext *octx, |
| 706 | const OptionGroupDef *groups, int nb_groups) |