+static void opt_invoke_hooks(struct opt_context *oc, uns event, struct opt_item *item, char *value)
+{
+ for (int i = 0; i < oc->hook_count; i++) {
+ struct opt_item *hook = oc->hooks[i];
+ if (hook->flags & event) {
+ void *data = (hook->flags & OPT_HOOK_INTERNAL) ? oc : hook->ptr;
+ hook->u.hook(item, event, value, data);
+ }
+ }
+}
+