MCPcopy Index your code
hub / github.com/git/git / configset_find_element

Function configset_find_element

config.c:1718–1741  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1716}
1717
1718RESULT_MUST_BE_USED
1719static int configset_find_element(struct config_set *set, const char *key,
1720 struct config_set_element **dest)
1721{
1722 struct config_set_element k;
1723 struct config_set_element *found_entry;
1724 char *normalized_key;
1725 int ret;
1726
1727 /*
1728 * `key` may come from the user, so normalize it before using it
1729 * for querying entries from the hashmap.
1730 */
1731 ret = git_config_parse_key(key, &normalized_key, NULL);
1732 if (ret)
1733 return ret;
1734
1735 hashmap_entry_init(&k.ent, strhash(normalized_key));
1736 k.key = normalized_key;
1737 found_entry = hashmap_get_entry(&set->config_hash, &k, ent, NULL);
1738 free(normalized_key);
1739 *dest = found_entry;
1740 return 0;
1741}
1742
1743static int configset_add_value(const struct key_value_info *kvi_p,
1744 struct config_set *set, const char *key,

Callers 3

configset_add_valueFunction · 0.85
git_configset_getFunction · 0.85

Calls 3

git_config_parse_keyFunction · 0.85
hashmap_entry_initFunction · 0.85
strhashFunction · 0.85

Tested by

no test coverage detected