summaryrefslogtreecommitdiff
path: root/src/attrcache.c
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2019-01-23 10:42:46 +0100
committerPatrick Steinhardt <ps@pks.im>2019-02-15 13:16:48 +0100
commit351eeff3b2a666b8ead5302c1130629597438df6 (patch)
tree5b494d3e5912949980fbbbb4945da4c2eb630aa1 /src/attrcache.c
parentbda0839734bad8351e1dbc9c7beb8ae1f00d831e (diff)
downloadlibgit2-351eeff3b2a666b8ead5302c1130629597438df6.tar.gz
maps: use uniform lifecycle management functions
Currently, the lifecycle functions for maps (allocation, deallocation, resize) are not named in a uniform way and do not have a uniform function signature. Rename the functions to fix that, and stick to libgit2's naming scheme of saying `git_foo_new`. This results in the following new interface for allocation: - `int git_<t>map_new(git_<t>map **out)` to allocate a new map, returning an error code if we ran out of memory - `void git_<t>map_free(git_<t>map *map)` to free a map - `void git_<t>map_clear(git<t>map *map)` to remove all entries from a map This commit also fixes all existing callers.
Diffstat (limited to 'src/attrcache.c')
-rw-r--r--src/attrcache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/attrcache.c b/src/attrcache.c
index cb8a4a4e9..6d241e4a5 100644
--- a/src/attrcache.c
+++ b/src/attrcache.c
@@ -400,8 +400,8 @@ int git_attr_cache__init(git_repository *repo)
/* allocate hashtable for attribute and ignore file contents,
* hashtable for attribute macros, and string pool
*/
- if ((ret = git_strmap_alloc(&cache->files)) < 0 ||
- (ret = git_strmap_alloc(&cache->macros)) < 0)
+ if ((ret = git_strmap_new(&cache->files)) < 0 ||
+ (ret = git_strmap_new(&cache->macros)) < 0)
goto cancel;
git_pool_init(&cache->pool, 1);