Namespace/path alignment: the one " . " candidate that sits * where its namespace says. NULL when none or several do. */
| 2051 | /* Namespace/path alignment: the one "<Class>.<member>" candidate that sits |
| 2052 | * where its namespace says. NULL when none or several do. */ |
| 2053 | static const char *aligned_member_qn(const cbm_registry_t *r, const char *fqn, size_t ns_len, |
| 2054 | const char *cls, size_t cls_len, const char *member) { |
| 2055 | const qn_array_t *arr = cbm_ht_get(r->by_name, member); |
| 2056 | const char *match = NULL; |
| 2057 | for (int i = 0; arr && i < arr->count; i++) { |
| 2058 | const char *qn = arr->items[i]; |
| 2059 | int tail = qn_class_member_tail(qn, cls, cls_len, member); |
| 2060 | if (tail == CBM_NOT_FOUND || !namespace_matches_dirs(qn, tail, fqn, ns_len)) { |
| 2061 | continue; |
| 2062 | } |
| 2063 | if (match) { |
| 2064 | return NULL; /* ambiguous */ |
| 2065 | } |
| 2066 | match = qn; |
| 2067 | } |
| 2068 | return match; |
| 2069 | } |
| 2070 | |
| 2071 | cbm_resolution_t cbm_registry_resolve_handler(const cbm_registry_t *r, const char *handler_ref, |
| 2072 | const char *module_qn, const char **import_map_keys, |
no test coverage detected