-for (int bot = 0, top = lookup_list_count; top > bot; )
- {
- int mid = (top + bot)/2;
- int c = Ustrncmp(name, lookup_list[mid]->name, len);
-
- /* If c == 0 we have matched the incoming name with the start of the search
- type name. However, some search types are substrings of others (e.g. nis and
- nisplus) so we need to check that the lengths are the same. The length of the
- type name cannot be shorter (else c would not be 0); if it is not equal it
- must be longer, and in that case, the incoming name comes before the name we
- are testing. By leaving c == 0 when the lengths are different, and doing a
- > 0 test below, this all falls out correctly. */
-
- if (c == 0 && Ustrlen(lookup_list[mid]->name) == len)
- {
- if (lookup_list[mid]->find != NULL) return mid;
- search_error_message = string_sprintf("lookup type \"%.*s\" is not "
- "available (not in the binary - check buildtime LOOKUP configuration)",
- len, name);
- return -1;
- }
+const uschar * s = name[len] ? string_copyn(name, len) : name;
+tree_node * t = tree_search(lookups_tree, s);