| 1716 | } |
| 1717 | |
| 1718 | RESULT_MUST_BE_USED |
| 1719 | static 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 | |
| 1743 | static int configset_add_value(const struct key_value_info *kvi_p, |
| 1744 | struct config_set *set, const char *key, |
no test coverage detected