void array_items_visit(ArrayItems *a, VisitorEnterFunc enter_func, VisitorExitFunc exit_func, void *ctxt) { if (a->generic_validator) { enter_func(NULL, a->generic_validator, ctxt); validator_visit(a->generic_validator, enter_func, exit_func, ctxt); Validator *new_v = NULL; exit_func(NULL, a->generic_validator, ctxt, &new_v); if (new_v) { validator_unref(a->generic_validator); a->generic_validator = new_v; } } GList *it = a->validators; while (it) { Validator *v = (Validator *) it->data; enter_func(NULL, v, ctxt); validator_visit(v, enter_func, exit_func, ctxt); Validator *new_v = NULL; exit_func(NULL, v, ctxt, &new_v); if (new_v) { validator_unref(v); it->data = new_v; } it = g_list_next(it); } }
static void _visit(Validator *v, VisitorEnterFunc enter_func, VisitorExitFunc exit_func, void *ctxt) { SchemaParsing *s = (SchemaParsing *) v; validator_visit((Validator *)s->definitions, enter_func, exit_func, ctxt); if (s->type_validator) { enter_func(NULL, s->type_validator, ctxt); validator_visit(s->type_validator, enter_func, exit_func, ctxt); Validator *new_v = NULL; exit_func(NULL, s->type_validator, ctxt, &new_v); if (new_v) { validator_unref(s->type_validator); s->type_validator = new_v; } } if (s->extends) { enter_func(NULL, s->extends, ctxt); validator_visit(s->extends, enter_func, exit_func, ctxt); Validator *new_v = NULL; exit_func(NULL, s->extends, ctxt, &new_v); if (new_v) { validator_unref(s->extends); s->extends = new_v; } } GSList *it = s->validator_combinators; while(it) { Validator *v = it->data; if (!v) continue; enter_func(NULL, v, ctxt); validator_visit(v, enter_func, exit_func, ctxt); Validator *new_v = NULL; exit_func(NULL, v, ctxt, &new_v); if (new_v) { validator_unref(v); it->data = new_v; } it = g_slist_next(it); } }
static void _visit(Validator *v, VisitorEnterFunc enter_func, VisitorExitFunc exit_func, void *ctxt) { ArrayValidator *a = (ArrayValidator *) v; if (a->additional_items) { enter_func(NULL, a->additional_items, ctxt); validator_visit(a->additional_items, enter_func, exit_func, ctxt); Validator *new_v = NULL; exit_func(NULL, a->additional_items, ctxt, &new_v); if (new_v) { validator_unref(a->additional_items); a->additional_items = new_v; } } if (a->items) array_items_visit(a->items, enter_func, exit_func, ctxt); }