/* lookup child node */
search.c = c;
- child = bsearch_safe(&search, node->children, node->children_count,
- sizeof(struct strbuf_child_entry),
- (__compar_fn_t) strbuf_children_cmp);
+ child = typesafe_bsearch(&search, node->children, node->children_count, strbuf_children_cmp);
if (!child)
break;
node = child->child;
struct trie_child_entry search;
search.c = c;
- child = bsearch_safe(&search, node->children, node->children_count, sizeof(struct trie_child_entry), (comparison_fn_t) trie_children_cmp);
+ child = typesafe_bsearch(&search, node->children, node->children_count, trie_children_cmp);
if (child)
return child->child;
return NULL;
.value_off = v,
};
- val = xbsearch_r(&search, node->values, node->values_count, sizeof(struct trie_value_entry), (__compar_d_fn_t) trie_values_cmp, trie);
+ val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie);
if (val) {
/* At this point we have 2 identical properties on the same match-string.
* Since we process files in order, we just replace the previous value.
struct trie_child_entry search;
search.c = c;
- child = bsearch_safe(&search,
- node->children, node->children_count, sizeof(struct trie_child_entry),
- (comparison_fn_t) trie_children_cmp);
+ child = typesafe_bsearch(&search, node->children, node->children_count, trie_children_cmp);
if (child)
return child->child;
return NULL;
.value_off = v,
};
- val = xbsearch_r(&search, node->values, node->values_count, sizeof(struct trie_value_entry), (__compar_d_fn_t) trie_values_cmp, trie);
+ val = typesafe_bsearch_r(&search, node->values, node->values_count, trie_values_cmp, trie);
if (val) {
/* replace existing earlier key with new value */
val->value_off = v;