exit(0);
}
-void opt_conf_hook_internal(struct opt_item * opt, const char * value UNUSED, void * data UNUSED) {
+void opt_conf_hook_internal(struct opt_item * opt, uns event, const char * value UNUSED, void * data UNUSED) {
static enum {
OPT_CONF_HOOK_BEGIN,
OPT_CONF_HOOK_CONFIG,
OPT_CONF_HOOK_OTHERS
} state = OPT_CONF_HOOK_BEGIN;
+ struct cf_context *cc = cf_get_context();
+
+ if (event == OPT_HOOK_FINAL) {
+ opt_conf_end_of_options(cc);
+ return;
+ }
+
+ ASSERT(event == OPT_HOOK_BEFORE_VALUE);
bool confopt = opt->flags & OPT_BEFORE_CONFIG;
if (confopt)
state = OPT_CONF_HOOK_CONFIG;
else {
- opt_conf_end_of_options(cf_get_context());
+ opt_conf_end_of_options(cc);
state = OPT_CONF_HOOK_OTHERS;
}
break;
case OPT_CONF_HOOK_CONFIG:
if (!confopt) {
- opt_conf_end_of_options(cf_get_context());
+ opt_conf_end_of_options(cc);
state = OPT_CONF_HOOK_OTHERS;
}
break;