* Find a hook * * Node types may supply their own optimized routines for finding * hooks. If none is supplied, we just do a linear search. * XXX Possibly we should add a reference to the hook? */
| 1122 | * XXX Possibly we should add a reference to the hook? |
| 1123 | */ |
| 1124 | hook_p |
| 1125 | ng_findhook(node_p node, const char *name) |
| 1126 | { |
| 1127 | hook_p hook; |
| 1128 | |
| 1129 | if (node->nd_type->findhook != NULL) |
| 1130 | return (*node->nd_type->findhook)(node, name); |
| 1131 | LIST_FOREACH(hook, &node->nd_hooks, hk_hooks) { |
| 1132 | if (NG_HOOK_IS_VALID(hook) && |
| 1133 | (strcmp(NG_HOOK_NAME(hook), name) == 0)) |
| 1134 | return (hook); |
| 1135 | } |
| 1136 | return (NULL); |
| 1137 | } |
| 1138 | |
| 1139 | /* |
| 1140 | * Destroy a hook |
no test coverage detected